Skip to content

Field Tables

Header values and method arguments such as queue_declare(arguments=...) are AMQP field tables. pika chooses each value's field type from its Python type: str is sent as S, bytes as x, bool as t, float as d, int as I or l as described below, decimal.Decimal as D, datetime as T, dict as F, list as A and None as V. Import the 64-bit marker type as pika.data.LongLong.

LongLong

Bases: int

An int that is sent as a signed 64-bit l field-table value, whatever its magnitude.

A plain int is sent as I when it fits a signed 32 bits and as l otherwise. l is how Java sends a Long, .NET a long and Go an int64, and what each decodes l into. Values decoded from l or L fields are LongLong, so a received header is sent on with the same type. Arithmetic on a LongLong returns a plain int, and a serializer that accepts only an exact int, such as yaml.safe_dump, needs int(value).

Encoding a value outside signed 64-bit raises pika.exceptions.UnencodableLongError.

Source code in pika/data.py
class LongLong(int):
    """
    An `int` that is sent as a signed 64-bit `l` field-table value, whatever its magnitude.

    A plain `int` is sent as `I` when it fits a signed 32 bits and as `l` otherwise. `l` is how Java
    sends a `Long`, .NET a `long` and Go an `int64`, and what each decodes `l` into. Values decoded
    from `l` or `L` fields are `LongLong`, so a received header is sent on with the same type.
    Arithmetic on a `LongLong` returns a plain `int`, and a serializer that accepts only an exact
    `int`, such as `yaml.safe_dump`, needs `int(value)`.

    Encoding a value outside signed 64-bit raises `pika.exceptions.UnencodableLongError`.
    """

    __slots__ = ()