Class Envelope
Envelope — это 24-байтный little-endian заголовок, который записывается перед каждой пользовательской полезной нагрузкой. Он принадлежит транспортному протоколу и не зависит от пользовательского codec layer.
Envelope is a fixed 24-byte little-endian header written before every user payload. It belongs to the transport protocol and is independent of the user message codec layer.
Структура заголовка / Envelope layout:
offset size field description
0 2 magic fixed RPC signature, 0xAE01
2 2 version envelope format version
4 4 messageTypeId routing message type
8 8 correlationId transport-level correlation id
16 4 flags bit 0: request, bit 1: heartbeat, bit 2: error
20 4 payloadLength payload size after the envelope, in bytes
Размер envelope намеренно равен 24 байтам. / The envelope length is intentionally 24 bytes:
- размер кратен 8 и сохраняет естественное выравнивание полей / the size is divisible by 8 and keeps the fields naturally aligned;
MAGICandVERSIONпомогают выявлять чужие, поврежденные или устаревшие кадры / help diagnose foreign, corrupted, or outdated frames;OFFSET_PAYLOAD_LENхранит длину payload явно, что удобно для валидации и вложенных форматов / stores the payload length explicitly, which helps with validation and nested formats.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intФлаг, помечающий envelope как structured remote error response.static final intФлаг, помечающий envelope как heartbeat frame.static final intФлаг, помечающий envelope как RPC-запрос.static final intРазмер заголовка envelope в байтах.static final shortФиксированная сигнатура протокола в начале каждого envelope.static final intСмещение поля correlation id внутри envelope, в байтах.static final intСмещение поля флагов внутри envelope, в байтах.static final intСмещение поляMAGICвнутри envelope, в байтах.static final intСмещение поля идентификатора типа сообщения внутри envelope, в байтах.static final intСмещение поля длины payload внутри envelope, в байтах.static final intСмещение поляVERSIONвнутри envelope, в байтах.static final intЗарезервированный тип сообщения для heartbeat frame-ов.static final intЗарезервированный тип сообщения для optional protocol handshake frame-ов.static final shortТекущая версия формата envelope. -
Method Summary
-
Field Details
-
LENGTH
public static final int LENGTHРазмер заголовка envelope в байтах.Size of the envelope header in bytes.
- See Also:
-
MAGIC
public static final short MAGICФиксированная сигнатура протокола в начале каждого envelope.Fixed protocol signature written at the beginning of every envelope.
- See Also:
-
VERSION
public static final short VERSIONТекущая версия формата envelope.Current envelope format version.
- See Also:
-
OFFSET_MAGIC
-
OFFSET_VERSION
-
OFFSET_MESSAGE_TYPE
public static final int OFFSET_MESSAGE_TYPEСмещение поля идентификатора типа сообщения внутри envelope, в байтах.Byte offset of the message type identifier field inside the envelope.
- See Also:
-
OFFSET_CORRELATION_ID
public static final int OFFSET_CORRELATION_IDСмещение поля correlation id внутри envelope, в байтах.Byte offset of the correlation identifier field inside the envelope.
- See Also:
-
OFFSET_FLAGS
public static final int OFFSET_FLAGSСмещение поля флагов внутри envelope, в байтах.Byte offset of the flags field inside the envelope.
- See Also:
-
OFFSET_PAYLOAD_LEN
public static final int OFFSET_PAYLOAD_LENСмещение поля длины payload внутри envelope, в байтах.Byte offset of the payload length field inside the envelope.
- See Also:
-
FLAG_IS_REQUEST
public static final int FLAG_IS_REQUESTФлаг, помечающий envelope как RPC-запрос.Flag bit that marks an envelope as an RPC request.
- See Also:
-
FLAG_IS_HEARTBEAT
public static final int FLAG_IS_HEARTBEATФлаг, помечающий envelope как heartbeat frame.Flag bit that marks an envelope as a heartbeat frame.
- See Also:
-
FLAG_IS_ERROR
public static final int FLAG_IS_ERRORФлаг, помечающий envelope как structured remote error response.Error frames still use the normal response message type id and correlation id, but their payload is interpreted as a transport error body instead of a user response payload.
- See Also:
-
RESERVED_HEARTBEAT
public static final int RESERVED_HEARTBEATЗарезервированный тип сообщения для heartbeat frame-ов.Пользовательские message type id должны быть положительными и не должны использовать reserved values.
Reserved message type identifier used for heartbeat frames. User-defined message type identifiers should be positive and must not use reserved values.
- See Also:
-
RESERVED_PROTOCOL_HANDSHAKE
public static final int RESERVED_PROTOCOL_HANDSHAKEЗарезервированный тип сообщения для optional protocol handshake frame-ов.Reserved message type identifier used for optional protocol handshake frames.
- See Also:
-