File: //usr/local/lib/python3.9/site-packages/kombu/__pycache__/entity.cpython-39.pyc
a
X>h�� � @ s� d Z ddlmZ ddlZddlmZmZ ddlmZ ddl m
Z
dZdZeed �Z
d
ZdZdd
� Zdd� Zdefdd�ZG dd� de�ZG dd� de�ZG dd� de�ZdS )z Exchange and Queue declarations.� )�annotationsN� )�MaybeChannelBound�Object)�ContentDisallowed)�prepare_accept_content� )Z transient�
persistent)�Exchange�Queue�binding�maybe_delivery_mode)zamq.c C s4 t | �} t| t�r(| �d�r(| dd� S | dd� S )Nzu'r ���r )�repr�
isinstance�str�
startswith)�s� r �6/usr/local/lib/python3.9/site-packages/kombu/entity.py�_reprstr s r c C s d� d�tt| ���S )Nz[{}]z, )�format�join�mapr )�bindingsr r r �pretty_bindings s r c C s, |st n|}| r(t| tj�r | S || S |S )z1Get delivery mode by name (or none if undefined).)�DELIVERY_MODESr �numbers�Integral)�v�modes�defaultr r r r
s r
c s� e Zd ZdZeZeZdZdZdZdZ dZ
dZdZddd d
e
fde
fde
fd
dd� fde
ffZd/� fdd� Zdd� Zdd� Zd0dd�Zd1dd�Zd2dd�Zd3dd�Zd4dd �Zd5d!d"�Zd6d#d$�Zd%d&� Zd'd(� Zd)d*� Zd+d,� Zed-d.� �Z� ZS )7r
a An Exchange declaration.
Arguments:
---------
name (str): See :attr:`name`.
type (str): See :attr:`type`.
channel (kombu.Connection, ChannelT): See :attr:`channel`.
durable (bool): See :attr:`durable`.
auto_delete (bool): See :attr:`auto_delete`.
delivery_mode (enum): See :attr:`delivery_mode`.
arguments (Dict): See :attr:`arguments`.
no_declare (bool): See :attr:`no_declare`
Attributes
----------
name (str): Name of the exchange.
Default is no name (the default exchange).
type (str):
*This description of AMQP exchange types was shamelessly stolen
from the blog post `AMQP in 10 minutes: Part 4`_ by
Rajith Attapattu. Reading this article is recommended if you're
new to amqp.*
"AMQP defines four default exchange types (routing algorithms) that
covers most of the common messaging use cases. An AMQP broker can
also define additional exchange types, so see your broker
manual for more information about available exchange types.
* `direct` (*default*)
Direct match between the routing key in the message,
and the routing criteria used when a queue is bound to
this exchange.
* `topic`
Wildcard match between the routing key and the routing
pattern specified in the exchange/queue binding.
The routing key is treated as zero or more words delimited
by `"."` and supports special wildcard characters. `"*"`
matches a single word and `"#"` matches zero or more words.
* `fanout`
Queues are bound to this exchange with no arguments. Hence
any message sent to this exchange will be forwarded to all
queues bound to this exchange.
* `headers`
Queues are bound to this exchange with a table of arguments
containing headers and values (optional). A special
argument named "x-match" determines the matching algorithm,
where `"all"` implies an `AND` (all pairs must match) and
`"any"` implies `OR` (at least one pair must match).
:attr:`arguments` is used to specify the arguments.
.. _`AMQP in 10 minutes: Part 4`:
https://bit.ly/2rcICv5
channel (ChannelT): The channel the exchange is bound to (if bound).
durable (bool): Durable exchanges remain active when a server restarts.
Non-durable exchanges (transient exchanges) are purged when a
server restarts. Default is :const:`True`.
auto_delete (bool): If set, the exchange is deleted when all queues
have finished using it. Default is :const:`False`.
delivery_mode (enum): The default delivery mode used for messages.
The value is an integer, or alias string.
* 1 or `"transient"`
The message is transient. Which means it is stored in
memory only, and is lost if the server dies or restarts.
* 2 or "persistent" (*default*)
The message is persistent. Which means the message is
stored both in-memory, and on disk, and therefore
preserved if the server dies or restarts.
The default value is 2 (persistent).
arguments (Dict): Additional arguments to specify when the exchange
is declared.
no_declare (bool): Never declare this exchange
(:meth:`declare` does nothing).
� �directTFN��nameN)�typeN�� argumentsN�durable�passive�auto_delete�
delivery_modec C s t �| �p| S �N)r �get)�mr r r �<lambda>� � zExchange.<lambda>�
no_declarec s8 t � jf i |�� |p| j| _|p&| j| _| �|� d S r- )�super�__init__r% r&