Class InternalCodec
- All Implemented Interfaces:
Codec
Codec implementation that encodes and decodes messages in AMQP 1.0 format
using the library's own Amqp10 primitives, with no external AMQP library (e.g. QPid
Proton) required.
Encoding
encode(Message) returns a StreamingEncodedMessage that defers AMQP 1.0
serialization until write time. The encoded size is pre-computed eagerly so the caller can
allocate buffers of the right capacity, but no intermediate byte array is created. Encoding
writes the following sections in order when present: message annotations (symbol-keyed map),
properties (AMQP 1.0 properties list), application properties (string-keyed map), and body. The
body is encoded as an AMQP data section if Message.getBodyAsBinary() succeeds, as
an amqp-value section for non-binary bodies (e.g. a String), or as an empty data
section when the body is null.
Decoding
decode(ByteBuf, int) reads AMQP 1.0 described types from the given buffer region and
reconstructs an immutable Message. Decoded properties are backed by a positional
List (not a POJO), avoiding field-by-field allocation. Map sections (message annotations,
application properties) preserve insertion order via LinkedHashMap. AMQP
timestamp values are returned as raw long milliseconds, not Date
objects—this matches QPid Proton behavior but means a Date set on a property will round-
trip as a Long.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface Codec
Codec.EncodedMessage -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription
-
Constructor Details
-
InternalCodec
public InternalCodec()
-
-
Method Details
-
encode
-
decode
-
messageBuilder
- Specified by:
messageBuilderin interfaceCodec
-