HEX
Server: LiteSpeed
System: Linux kapuas.iixcp.rumahweb.net 5.14.0-427.42.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Nov 1 14:58:02 EDT 2024 x86_64
User: mirz4654 (1666)
PHP: 8.1.33
Disabled: system,exec,escapeshellarg,escapeshellcmd,passthru,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,popen,pclose,dl,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setsid,posix_setuid,posix_setpgid,ini_alter,show_source,define_syslog_variables,symlink,syslog,openlog,openlog,closelog,ocinumcols,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dll,ftp,myshellexec,socket_bind,mail,posix_getwpuid
Upload Files
File: //usr/local/lib/python3.9/site-packages/kombu/__pycache__/message.cpython-39.pyc
a

X>h��@stdZddlmZddlZddlmZddlmZmZddl	m
Z
ddlmZd	Z
hd
�Zeed�ZGdd
�d
�ZdS)zMessage class.�)�annotationsN�)�
decompress)�MessageStateError�reraise)�loads)�
dictfilter)�Message>�REQUEUED�ACK�REJECTED�pypy_version_infoc
@s�eZdZdZeZdZesdZddd�Zddd�Z	dd	d
�Z
d dd�Zd!d
d�Zd"dd�Z
dd�Zdd�Zdd�Zedd��Zedd��Zdd�ZdS)#r	auBase 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
Ks�|sin|}|jdurgn|j|_|
|_||_||_||_||_|pFi|_|pPi|_d|_d|_	|	|_
|j�d�}|js�|r�zt||�}Wn"t
y�|j�t���Yn0|js�|r�t|t�r�z|�|�}Wn"t
y�|j�t���Yn0||_dS)NZRECEIVED�compression)�errorsrrrrrrrrrr�getr�	Exception�append�sys�exc_info�
isinstance�str�encoder)
�selfrrrrrrrZ
postencoderr�kwargsr�r&�7/usr/local/lib/python3.9/site-packages/kombu/message.py�__init__>s0


zMessage.__init__c
CsLzt|jd�Wn4tyF}z|s(�|||�WYd}~n
d}~00dS)Nr)rrr)r$�callback�excr&r&r'�_reraise_error]szMessage._reraise_errorFcCs�|jdur|�d��|jjdurRz|jd}Wnty@Yn0||jjvrRdS|jrh|�d�|���|jj|j|d�d|_	dS)z�Acknowledge this message as being processed.

        This will remove the message from the queue.

        Raises
        ------
            MessageStateError: If the message has already been
                acknowledged/requeued/rejected.
        N�.This message does not have a receiving channel�consumer_tag�3Message already acknowledged with state: {0._state}��multipler)
rrZno_ack_consumersr�KeyError�acknowledged�formatZ	basic_ackrr)r$r0r-r&r&r'�ackes&

���zMessage.ackc
Cs�z|j|d�WnptyJ}z"|jd|j|dd��WYd}~n@d}~0|y�}z |jd|j|dd�WYd}~n
d}~00dS)Nr/zCouldn't ack %r, reason:%rT�r )r4�BrokenPipeError�criticalr)r$�loggerrr0r*r&r&r'�
ack_log_error�s��zMessage.ack_log_errorc
CsNz|j|d�Wn8|yH}z |jd|j|dd�WYd}~n
d}~00dS)N��requeuezCouldn't reject %r, reason: %rTr5)�rejectr7r)r$r8rr;r*r&r&r'�reject_log_error�s�zMessage.reject_log_errorcCsF|jdur|�d��|jr*|�d�|���|jj|j|d�d|_dS)z�Reject this message.

        The message will be discarded by the server.

        Raises
        ------
            MessageStateError: If the message has already been
                acknowledged/requeued/rejected.
        Nr,r.r:r�rrr2r3Zbasic_rejectrr)r$r;r&r&r'r<�s

���zMessage.rejectcCsF|jdur|�d��|jr*|�d�|���|jj|jdd�d|_dS)aLReject this message and put it back on the queue.

        Warning:
        -------
            You must not use this method as a means of selecting messages
            to process.

        Raises
        ------
            MessageStateError: If the message has already been
                acknowledged/requeued/rejected.
        Nr,r.Tr:r
r>�r$r&r&r'r;�s
���zMessage.requeuecCs|js|��|_|jS)z�Deserialize the message body.

        Returning the original python structure sent by the publisher.

        Note:
        ----
            The return value is memoized, use `_decode` to force
            re-evaluation.
        )r�_decoder?r&r&r'�decode�s

zMessage.decodecCst|j|j|j|jd�S)N)r)rrrrrr?r&r&r'r@�s
�zMessage._decodecCs
|jtvS)z1Set to true if the message has been acknowledged.)r�
ACK_STATESr?r&r&r'r2�szMessage.acknowledgedcCs|jr|jS|��S)zThe decoded message body.)rrAr?r&r&r'�payload�szMessage.payloadcCsrd�t|�jt|�t|j|j|j|jdur4t	|j�ndt|j
�d�|j
�d�d�t|j�d�|j�d�d�d��S)	Nz&<{} object at {:#x} with details {!r}>�correlation_id�type)rDrE�exchange�routing_key)rFrG)�staterr�body_lengthrr)
r3rE�__name__�idrrrrr�lenrrrr?r&r&r'�__repr__�s 

�

���zMessage.__repr__)
NNNNNNNNNN)N)F)F)F)F)rJ�
__module__�__qualname__�__doc__rr�IS_PYPY�	__slots__r(r+r4r9r=r<r;rAr@�propertyr2rCrMr&r&r&r'r	s.�







r	)rP�
__future__rrrr�
exceptionsrrZ
serializationrZutils.functionalr�__all__rB�hasattrrQr	r&r&r&r'�<module>s