File: //usr/local/lib/python3.9/site-packages/kombu/__pycache__/messaging.cpython-39.pyc
a
X>h)b � @ s� d Z ddlmZ ddlmZ ddlmZ ddlmZ ddl m
Z
ddlmZm
Z
mZ dd lmZmZmZ dd
lmZ ddlmZmZ ddlmZmZ er�dd
lmZ dZG dd� d�ZG dd� d�ZdS )zSending and receiving messages.� )�annotations)�count)�
TYPE_CHECKING� )�
maybe_declare)�compress)�PooledConnection�
is_connection�
maybe_channel)�Exchange�Queue�maybe_delivery_mode)�ContentDisallowed)�dumps�prepare_accept_content)�ChannelPromise�
maybe_list)�
TracebackType)r r �Producer�Consumerc @ s� e Zd ZdZdZdZdZdZdZdZ dZ
d.dd�Zdd� Zd d
� Z
dd� Zd
d� Zd/dd�Zdeefdd�Zd0dd�Zd1dd�Zdd� Zdd� Zeee�Zdd� Zdd � Zd!d"d#d$d%�d&d'�Zd(d)� ZeZd2d*d+�Zed,d-� �Z dS )3r a� Message Producer.
Arguments:
---------
channel (kombu.Connection, ChannelT): Connection or channel.
exchange (kombu.entity.Exchange, str): Optional default exchange.
routing_key (str): Optional default routing key.
serializer (str): Default serializer. Default is `"json"`.
compression (str): Default compression method.
Default is no compression.
auto_declare (bool): Automatically declare the default exchange
at instantiation. Default is :const:`True`.
on_return (Callable): Callback to call for undeliverable messages,
when the `mandatory` or `immediate` arguments to
:meth:`publish` is used. This callback needs the following
signature: `(exception, exchange, routing_key, message)`.
Note that the producer needs to drain events to use this feature.
N� Tc C sz || _ || _|p| j| _|p | j| _|p,| j| _|p8| j| _d | _| jd u rVtd�| _|d urd|| _| j rv| � | j � d S )Nr )
�_channel�exchange�routing_key�
serializer�compression� on_returnZ_channel_promiser �auto_declare�revive)�self�channelr r r r r r � r! �9/usr/local/lib/python3.9/site-packages/kombu/messaging.py�__init__A s
zProducer.__init__c C s d| j � d�S )Nz<Producer: �>�r �r r! r! r"