3. Message Data Types

Note

Support for AMQP 1.0 encoding and decoding is work in progress.

Message body, sent to a RabbitMQ stream, is any Python object having one of the types

bytes

A data section of AMQP message containing opaque binary data. It can carry any binary message encoded with third-party encoders like MessagePack.

The data type is also accepted as a member of a container type like sequence, or dictionary.

None

An AMQP message with null value.

str

An AMQP message with string value encoded with Unicode.

bool

An AMQP message with boolean value (true or false).

int

An AMQP message with integer value. The value is encoded with AMQP type as defined by the table

Value Range

AMQP Type Name

[-231, 231 - 1]

int

[-263, 263 - 1]

long

[263, 264 - 1]

ulong

All other, AMQP integer types are parsed as Python int type.

float

An AMQP message with value of AMQP type double. AMQP type float is parsed as value of Python type float, as well.

sequence

An AMQP message with value of AMQP type list. Python list and tuple types are supported when serializing to AMQP format. Always decoded into a Python list.

dict

An AMQP message with value of AMQP type map. The order of key-value pairs in a map is preserved on encoding and decoding. In AMQP standard, the order of key-value pairs is semantically important, but this is not the case for Python dictionary.

datetime.datetime

An AMQP message with value of AMQP type timestamp. Unaware datetime object is encoded as UTC timestamp value. Decoded datetime object has UTC timezone.

uuid.UUID

An AMQP message with an universally unique identifier as defined by RFC-4122, section 4.1.2.

Symbol

Symbolic value from a constrained domain. The value is an ASCII string.