AMQP Types¶
These tables summarize the various AMQP types and their Python API equivalents as used in the API.
Scalar Types¶
AMQP Type |
Proton C API Type |
Proton Python API Type |
Description |
---|---|---|---|
null |
PN_NONE |
|
Indicates an empty value. |
boolean |
PN_BOOL |
|
Represents a true or false value. |
ubyte |
PN_UBYTE |
Integer in the range \(0\) to \(2^8 - 1\) inclusive. |
|
byte |
PN_BYTE |
Integer in the range \(-(2^7)\) to \(2^7 - 1\) inclusive. |
|
ushort |
PN_USHORT |
Integer in the range \(0\) to \(2^{16} - 1\) inclusive. |
|
short |
PN_SHORT |
Integer in the range \(-(2^{15})\) to \(2^{15} - 1\) inclusive. |
|
uint |
PN_UINT |
Integer in the range \(0\) to \(2^{32} - 1\) inclusive. |
|
int |
PN_INT |
Integer in the range \(-(2^{31})\) to \(2^{31} - 1\) inclusive. |
|
char |
PN_CHAR |
A single Unicode character. |
|
ulong |
PN_ULONG |
Integer in the range \(0\) to \(2^{64} - 1\) inclusive. |
|
long |
PN_LONG |
|
Integer in the range \(-(2^{63})\) to \(2^{63} - 1\) inclusive. |
timestamp |
PN_TIMESTAMP |
An absolute point in time with millisecond precision. |
|
float |
PN_FLOAT |
32-bit floating point number (IEEE 754-2008 binary32). |
|
double |
PN_DOUBLE |
|
64-bit floating point number (IEEE 754-2008 binary64). |
decimal32 |
PN_DECIMAL32 |
32-bit decimal number (IEEE 754-2008 decimal32). |
|
decimal64 |
PN_DECIMAL64 |
64-bit decimal number (IEEE 754-2008 decimal64). |
|
decimal128 |
PN_DECIMAL128 |
128-bit decimal number (IEEE 754-2008 decimal128). |
|
uuid |
PN_UUID |
|
A universally unique identifier as defined by RFC-4122 section 4.1.2. |
binary |
PN_BINARY |
|
A sequence of octets. |
string |
PN_STRING |
|
A sequence of Unicode characters. |
symbol |
PN_SYMBOL |
Symbolic values from a constrained domain. |
Compound Types¶
AMQP Type |
Proton C API Type |
Proton Python API Type |
Description |
---|---|---|---|
array |
PN_ARRAY |
A sequence of values of a single type. |
|
list |
PN_LIST |
|
A sequence of polymorphic values. |
map |
PN_MAP |
|
A polymorphic mapping from distinct keys to values. |
Specialized Types¶
The following classes implement specialized or restricted types to help enforce type restrictions in the AMQP specification.
Proton Python API Type |
Description |
Where used in API |
---|---|---|
A |
|
|
A |
||
A |
These types would typically be used where the the above attributes are set. They will silently convert strings to symbols, but will raise an error if a not-allowed type is used. For example:
>>> from proton import symbol, ulong, Message, AnnotationDict
>>> msg = Message()
>>> msg.annotations = AnnotationDict({'one':1, symbol('two'):2, ulong(3):'three'})
>>> msg.annotations
AnnotationDict({symbol('one'): 1, symbol('two'): 2, ulong(3): 'three'})
>>> m.instructions = AnnotationDict({'one':1, symbol('two'):2, ulong(3):'three', 4:'four'})
...
KeyError: "invalid non-symbol key: <class 'int'>: 4"
>>> m.instructions
>>>