RabbitMQ
RabbitMQ speaks AMQP 0-9-1, a binary, frame-based messaging protocol.
Note that AMQP 1.0 is a different protocol despite the shared name, with different framing and a different model. DataStream speaks it through the rabbitmq and amqp devices and targets when they set protocol: "1.0", through the amazonmq device and target (always on the activemq engine, and with protocol: "1.0" on rabbitmq), and through the Azure Service Bus and Event Hubs targets. This page describes AMQP 0-9-1 only; nothing on it applies to an AMQP 1.0 connection.
Connection
A connection opens with an 8-byte protocol header, which is the first thing on the wire:
"AMQP" 0x00 0x00 0x09 0x01
The server replies with connection.start and the two sides then exchange start-ok, tune, tune-ok, open and open-ok. The tuning step negotiates the maximum frame size, the channel limit and the heartbeat interval.
There is no in-band upgrade to TLS—AMQP 0-9-1 has no STARTTLS. A TLS connection is established before the protocol header is sent, conventionally on port 5671 rather than 5672.
Binary Layout
| Field | Internal Name | Description | Type / Format | Example / Values |
|---|---|---|---|---|
| Type | frame_type | Type of frame | uint8 | 1 = Method, 2 = Header, 3 = Body, 8 = Heartbeat |
| Channel | channel_id | Channel number | uint16 | e.g. 1, 0 for connection-level |
| Size | frame_size | Payload size in bytes | uint32 | e.g. 0x00000014 |
| Payload | payload | Frame-specific data | Binary | Depends on frame_type |
| End | frame_end | Frame terminator | uint8 | Always 0xCE |
Frame Types
| Type | Name | Purpose |
|---|---|---|
1 | Method | AMQP method calls (open, close, publish, etc.) |
2 | Header | Content header with properties |
3 | Body | Message content data |
8 | Heartbeat | Keep-alive signal |
These four are the complete set defined by AMQP 0-9-1.
Publishing a message takes three frames in sequence on the same channel: a Method frame carrying basic.publish, a Header frame carrying the content properties and body size, and one or more Body frames carrying the payload.
Exchange Types
| Type | Routing |
|---|---|
direct | To queues whose binding key equals the routing key |
fanout | To every bound queue, ignoring the routing key |
topic | To queues whose binding pattern matches the routing key |
headers | To queues whose binding arguments match the message headers, ignoring the routing key |
x-… | Routing supplied by a broker plugin's type, such as x-consistent-hash |
Authentication
The SASL mechanism is selected during connection.start-ok, where plain and amqplain also send their credentials. Three SASL mechanisms are supported:
| Mechanism | Description |
|---|---|
plain | Username and password, as a single NUL-separated string |
amqplain | Username and password, as an AMQP field table |
external | The client certificate presented during the TLS handshake authenticates the connection (RabbitMQ's rabbitmq_auth_mechanism_ssl plugin). RabbitMQ maps the certificate's identity to the user name — its subject DN by default, or the common name or a subject alternative name that ssl_cert_login_from selects — and that user must exist |
The challenge-response mechanisms are not supported.