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 only through the Azure Service Bus and Event Hubs targets; nothing on this page applies to those.
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 |
x-custom | Routing supplied by a broker plugin |
Authentication
Credentials are exchanged during connection.start-ok. Two 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 and the challenge-response mechanisms are not supported.