File: //usr/local/lib/python3.9/site-packages/kombu/transport/__pycache__/azureservicebus.cpython-39.pyc
a
X>hzG � @ s> d Z ddlmZ ddlZddlmZ ddlmZ ddlZ ddl
Z ddlZddlm
Z
mZmZmZmZ ddlmZ zddlmZmZ W n ey� dZdZY n0 dd lmZmZ dd
lmZmZ ddlmZ dd
l m!Z! e"ej#�h d� Z$e%d�e%d�idd� e$D ��Z&G dd� d�Z'G dd� de!j(�Z(G dd� de!j)�Z)dS )aX Azure Service Bus Message Queue transport module for kombu.
Note that the Shared Access Policy used to connect to Azure Service Bus
requires Manage, Send and Listen claims since the broker will create new
queues and delete old queues as required.
Notes when using with Celery if you are experiencing issues with programs not
terminating properly. The Azure Service Bus SDK uses the Azure uAMQP library
which in turn creates some threads. If the AzureServiceBus Channel is closed,
said threads will be closed properly, but it seems there are times when Celery
does not do this so these threads will be left running. As the uAMQP threads
are not marked as Daemon threads, they will not be killed when the main thread
exits. Setting the ``uamqp_keep_alive_interval`` transport option to 0 will
prevent the keep_alive thread from starting
More information about Azure Service Bus:
https://azure.microsoft.com/en-us/services/service-bus/
Features
========
* Type: Virtual
* Supports Direct: *Unreviewed*
* Supports Topic: *Unreviewed*
* Supports Fanout: *Unreviewed*
* Supports Priority: *Unreviewed*
* Supports TTL: *Unreviewed*
Connection String
=================
Connection string has the following formats:
.. code-block::
azureservicebus://SAS_POLICY_NAME:SAS_KEY@SERVICE_BUSNAMESPACE
azureservicebus://DefaultAzureCredential@SERVICE_BUSNAMESPACE
azureservicebus://ManagedIdentityCredential@SERVICE_BUSNAMESPACE
Transport Options
=================
* ``queue_name_prefix`` - String prefix to prepend to queue names in a
service bus namespace.
* ``wait_time_seconds`` - Number of seconds to wait to receive messages.
Default ``5``
* ``peek_lock_seconds`` - Number of seconds the message is visible for before
it is requeued and sent to another consumer. Default ``60``
* ``uamqp_keep_alive_interval`` - Interval in seconds the Azure uAMQP library
should send keepalive messages. Default ``30``
* ``retry_total`` - Azure SDK retry total. Default ``3``
* ``retry_backoff_factor`` - Azure SDK exponential backoff factor.
Default ``0.8``
* ``retry_backoff_max`` - Azure SDK retry total time. Default ``120``
� )�annotationsN)�Empty)�Any)�ServiceBusClient�ServiceBusMessage�ServiceBusReceiveMode�ServiceBusReceiver�ServiceBusSender)�ServiceBusAdministrationClient)�DefaultAzureCredential�ManagedIdentityCredential)�bytes_to_str�safe_str)�dumps�loads)�cached_property� )�virtual> �.�-�_r r c C s i | ]}t |�t d ��qS )r )�ord)�.0�c� r �I/usr/local/lib/python3.9/site-packages/kombu/transport/azureservicebus.py�
<dictcomp>Y � r c @ s0 e Zd ZdZdddd�dd�Zdd �d
d�ZdS )
�SendReceivez"Container for Sender and Receiver.N�ServiceBusReceiver | None�ServiceBusSender | None��receiver�senderc C s || _ || _d S �Nr! )�selfr"