File: //usr/local/lib/python3.9/site-packages/kombu/__pycache__/message.cpython-39.pyc
a
X>h� � @ st d Z ddlmZ ddlZddlmZ ddlmZmZ ddl m
Z
ddlmZ d Z
h d
�Zeed�ZG dd
� d
�ZdS )zMessage class.� )�annotationsN� )�
decompress)�MessageStateError�reraise)�loads)�
dictfilter)�Message> �REQUEUED�ACK�REJECTED�pypy_version_infoc
@ s� e Zd ZdZeZdZesdZddd�Zddd�Z dd d
�Z
d dd�Zd!d
d�Zd"dd�Z
dd� Zdd� Zdd� Zedd� �Zedd� �Zdd� ZdS )#r au Base class for received messages.
Keyword Arguments:
-----------------
channel (ChannelT): If message was received, this should be the
channel that the message was received on.
body (str): Message body.
delivery_mode (bool): Set custom delivery mode.
Defaults to :attr:`delivery_mode`.
priority (int): Message priority, 0 to broker configured
max priority, where higher is better.
content_type (str): The messages content_type. If content_type
is set, no serialization occurs as it is assumed this is either
a binary object, or you've done your own serialization.
Leave blank if using built-in serialization as our library
properly sets content_type.
content_encoding (str): The character set in which this object
is encoded. Use "binary" if sending in raw binary objects.
Leave blank if using built-in serialization as our library
properly sets content_encoding.
properties (Dict): Message properties.
headers (Dict): Message headers.
N)�_state�channel�delivery_tag�content_type�content_encoding�
delivery_info�headers�
properties�body�_decoded_cache�accept�__dict__c
K s� |si n|}| j d u rg n| j | _ |
| _|| _|| _|| _|| _|pFi | _|pPi | _d | _d| _ | | _
| j�d�}| j s�|r�zt||�}W n" t
y� | j �t�� � Y n0 | j s�|r�t|t�r�z|�|�}W n" t
y� | j �t�� � Y n0 || _d S )NZRECEIVED�compression)�errorsr r r r r r r r r r �getr � Exception�append�sys�exc_info�
isinstance�str�encoder )
�selfr r r r r r r Z
postencoder r �kwargsr � r&