This document describes the current stable version of py-amqp (2.2). For development docs, go here.


AMQP Messages.

class amqp.basic_message.Message(body=u'', children=None, channel=None, **properties)[source]

A Message for use with the Channel.basic_* methods.

Expected arg types

body: string children: (not supported)

Keyword properties may include:

content_type: shortstr
MIME content type
content_encoding: shortstr
MIME content encoding
application_headers: table
Message header field table, a dict with string keys, and string | int | Decimal | datetime | dict values.
delivery_mode: octet
Non-persistent (1) or persistent (2)
priority: octet
The message priority, 0 to 9
correlation_id: shortstr
The application correlation identifier
reply_to: shortstr
The destination to reply to
expiration: shortstr
Message expiration specification
message_id: shortstr
The application message identifier
timestamp: datetime.datetime
The message timestamp
type: shortstr
The message type name
user_id: shortstr
The creating user id
app_id: shortstr
The creating application id
cluster_id: shortstr
Intra-cluster routing identifier

Unicode bodies are encoded according to the ‘content_encoding’ argument. If that’s None, it’s set to ‘UTF-8’ automatically.


msg = Message('hello world',
                application_headers={'foo': 7})
PROPERTIES = [(u'content_type', u's'), (u'content_encoding', u's'), (u'application_headers', u'F'), (u'delivery_mode', u'o'), (u'priority', u'o'), (u'correlation_id', u's'), (u'reply_to', u's'), (u'expiration', u's'), (u'message_id', u's'), (u'timestamp', u'L'), (u'type', u's'), (u'user_id', u's'), (u'app_id', u's'), (u'cluster_id', u's')]

Instances of this class have these attributes, which are passed back and forth as message properties between client and server

delivery_info = None

set by basic_consume/basic_get