Message

The Message represents a message that was delivered via Basic.GetOk or Basic.Deliver as well as a message that was returned by RabbitMQ via Basic.Return.

class aiorabbit.message.Message(method)[source]

Represents a message received from RabbitMQ

Parameters

method (typing.Union[pamqp.commands.Basic.Deliver, pamqp.commands.Basic.GetOk, pamqp.commands.Basic.Return]) – For internal use only

__bytes__()[source]

Return the message body if the instance is accessed using bytes(Message)

Return type

bytes

__len__()[source]

Return the length of the message body

Return type

int

property consumer_tag

If the delivered via Basic.Deliver, this provides the consumer tag it was delivered to.

Return type

typing.Optional[str]

property delivery_tag

If the message was delivered via Basic.Deliver, or retrieved via Basic.Get, this will indicate the delivery tag value, which is used when acknowledging, negative-acknowledging, or rejecting the message.

Return type

typing.Optional[int]

property exchange

Provides the exchange the message was published to

Return type

str

property routing_key

Provides the routing key the message was published with

Return type

str

property message_count

Provides the message_count if the message was retrieved using Basic.Get

Return type

typing.Optional[int]

property redelivered

Indicates if the message was redelivered.

Will return None if the message was returned via Basic.Return.

Return type

typing.Optional[bool]

property reply_code

If the message was returned via Basic.Return, indicates the the error code from RabbitMQ.

Return type

typing.Optional[int]

property reply_text

If the message was returned via Basic.Return, indicates the reason why.

Return type

typing.Optional[str]

property app_id

Provides the app_id property value if it is set.

Return type

typing.Optional[str]

property content_encoding

Provides the content_encoding property value if it is set.

Return type

typing.Optional[str]

property content_type

Provides the content_type property value if it is set.

Return type

typing.Optional[str]

property correlation_id

Provides the correlation_id property value if it is set.

Return type

typing.Optional[str]

property delivery_mode

Provides the delivery_mode property value if it is set.

Return type

typing.Optional[int]

property expiration

Provides the expiration property value if it is set.

Return type

typing.Optional[str]

property headers

Provides the headers property value if it is set.

Return type

typing.Optional[typing.Dict[str, typing.Any]]

property message_id

Provides the message_id property value if it is set.

Return type

typing.Optional[str]

property message_type

Provides the message_type property value if it is set.

Return type

typing.Optional[str]

property priority

Provides the priority property value if it is set.

Return type

typing.Optional[int]

property reply_to

Provides the reply_to property value if it is set.

Return type

typing.Optional[str]

property timestamp

Provides the timestamp property value if it is set.

Return type

typing.Optional[datetime.datetime]

property user_id

Provides the user_id property value if it is set.

Return type

typing.Optional[str]

property body

Provides the message body

Return type

bytes