pamqp.common

Common type aliases and classes.

pamqp.common.Arguments = typing.Union[typing.Dict[str, ForwardRef('FieldValue')], NoneType]

Defines an AMQP method arguments argument data type

pamqp.common.FieldArray = typing.List[ForwardRef('FieldValue')]

A data structure for holding an array of field values.

pamqp.common.FieldTable = typing.Dict[str, ForwardRef('FieldValue')]

Field tables are data structures that contain packed name-value pairs.

The name-value pairs are encoded as short string defining the name, and octet defining the values type and then the value itself. The valid field types for tables are an extension of the native integer, bit, string, and timestamp types, and are shown in the grammar. Multi-octet integer fields are always held in network byte order.

Guidelines for implementers:

  • Field names MUST start with a letter, ‘$’ or ‘#’ and may continue with letters, $ or #, digits, or underlines, to a maximum length of 128 characters.

  • The server SHOULD validate field names and upon receiving an invalid field name, it SHOULD signal a connection exception with reply code 503 (syntax error).

  • Decimal values are not intended to support floating point values, but rather fixed-point business values such as currency rates and amounts. They are encoded as an octet representing the number of places followed by a long signed integer. The ‘decimals’ octet is not signed.

  • Duplicate fields are illegal. The behaviour of a peer with respect to a table containing duplicate fields is undefined.

pamqp.common.FieldValue = typing.Union[bool, bytearray, decimal.Decimal, typing.List[ForwardRef('FieldValue')], typing.Dict[str, ForwardRef('FieldValue')], float, int, NoneType, str, datetime.datetime]

Defines valid field values for a FieldTable and a FieldValue

class pamqp.common.Struct[source]

Simple object for getting to the struct objects for pamqp.decode / pamqp.encode.

byte = <Struct object>
double = <Struct object>
float = <Struct object>
integer = <Struct object>
long = <Struct object>
long_long_int = <Struct object>
short = <Struct object>
short_short_int = <Struct object>
short_short_uint = <Struct object>
timestamp = <Struct object>
uint = <Struct object>
ulong = <Struct object>
ushort = <Struct object>