RocketMQ wire contracts: request/response codes, remoting command frames, custom headers, protocol bodies, compression, and trace encoding. This crate does not open sockets or own a Tokio runtime.
RequestCode,RemotingSysResponseCode, and thecodemodule define request and response identity.RemotingCommand,EncodedFrame, andEncodedFrameHeadrepresent commands and encoded frame parts.CommandCustomHeader,HeaderCodec,HeaderMap, andFromMapsupport typed header encoding and decoding. Derive macros are provided by rocketmq-macros.RpcRequestHeaderandTopicRequestHeaderprovide shared RPC header fields.ProtocolContractViolationreports invalid protocol contracts; operational failures retain canonicalrocketmq-erroridentity.
Business command construction uses RemotingCommandFactory with immutable RemotingCommandDefaults. An explicit factory can carry independent version/serialization settings without rereading process configuration. The compatibility application-default path is initialized by the application owner. JSON and RocketMQ binary serialization are distinct wire formats; changing a Rust field or enum must preserve its intended wire representation.
The hidden __request_header_codec module is support for generated code, not a general integration entry point. Networking, frame limits, connection admission, and request deadlines belong to rocketmq-transport.
Default features are empty. simd enables accelerated decoding paths through simd-json; callers still use the same protocol APIs. There is no server binary in this package.
Run from the root workspace:
cargo test -p rocketmq-protocol --test remoting_command_factory --test remoting_wire_golden
cargo test -p rocketmq-protocol --test message_codec_compatibility
cargo bench -p rocketmq-protocol --bench request_header_codecThe tests directory also contains Java compatibility fixtures and compile-fail coverage for header derives. Select the relevant codec and feature combination for a change.
Licensed under Apache-2.0.