Overview
AMQP (Advanced Message Queuing Protocol) is an open, binary wire-level messaging protocol, originally developed at JPMorgan Chase and later standardized by OASIS and ISO/IEC. It runs over TCP, on IANA-assigned port 5672 for cleartext traffic and 5671 for TLS-secured AMQPS, with SASL negotiation on 5672 also able to upgrade a connection to TLS in place. AMQP is broker-centric messaging middleware: producers publish messages to a broker (RabbitMQ, ActiveMQ, Azure Service Bus, etc.) that routes them via exchanges and queues (0-9-1) or link/node addressing (1.0) to consumers, making it common in enterprise messaging, IoT telemetry, and financial transaction systems.
Two incompatible wire formats circulate under the same protocol name and are readily distinguished on the wire: both open a connection with the fixed 8-byte ASCII preamble AMQP followed by a protocol-ID byte and three version bytes — 41 4D 51 50 00 00 09 01 for AMQP 0-9-1 (the format used by RabbitMQ) versus 41 4D 51 50 00 01 00 00 for AMQP 1.0 (the OASIS/ISO standard) — giving a reliable version fingerprint independent of payload. Traffic is cleartext by default unless the AMQPS/TLS variant or a SASL security layer is negotiated, and frames carry broker-, exchange-, and queue-name strings in plaintext that can further identify the messaging backend in use.
General Frame Format
| 0 |
12
|
36
|
7size+6
|
size+7 |
| type octet |
channel short |
size long |
payload 'size' octets |
frame-end octet |
AMQP defines these frame types:
| Type | Name | Description |
|---|---|---|
| 1 | METHOD |
Method frame. |
| 2 | HEADER |
Content header frame. |
| 3 | BODY |
Content body frame. |
| 4 | HEARTBEAT |
Heartbeat frame. |
Method Payloads
| 0 | 2 | 4 |
| class-id short |
method-id short |
arguments... ... |
Property and Method Summary
connection (Class ID 10)
| Method | ID | Description | Method | ID | Description |
|---|---|---|---|---|---|
start | 10 | start connection negotiation | tune-ok | 31 | negotiate connection tuning parameters |
start-ok | 11 | select security mechanism and locale | open | 40 | open connection to virtual host |
secure | 20 | security mechanism challenge | open-ok | 41 | signal that connection is ready |
secure-ok | 21 | security mechanism response | close | 50 | request a connection close |
tune | 30 | propose connection tuning parameters | close-ok | 51 | confirm a connection close |
channel (Class ID 20)
| Method | ID | Description | Method | ID | Description |
|---|---|---|---|---|---|
open | 10 | open a channel for use | flow-ok | 21 | confirm a flow method |
open-ok | 11 | signal that the channel is ready | close | 40 | request a channel close |
flow | 20 | enable/disable flow from peer | close-ok | 41 | confirm a channel close |
exchange (Class ID 40)
| Method | ID | Description | Method | ID | Description |
|---|---|---|---|---|---|
declare | 10 | verify exchange exists, create if needed | delete | 20 | delete an exchange |
declare-ok | 11 | confirm exchange declaration | delete-ok | 21 | confirm deletion of an exchange |
queue (Class ID 50)
| Method | ID | Description | Method | ID | Description |
|---|---|---|---|---|---|
declare | 10 | declare queue, create if needed | purge-ok | 31 | confirms a queue purge |
declare-ok | 11 | confirms a queue definition | delete | 40 | delete a queue |
bind | 20 | bind queue to an exchange | delete-ok | 41 | confirm deletion of a queue |
bind-ok | 21 | confirm bind successful | unbind | 50 | unbind a queue from an exchange |
purge | 30 | purge a queue | unbind-ok | 51 | confirm unbind successful |
basic (Class ID 60)
| Method | ID | Description | Method | ID | Description |
|---|---|---|---|---|---|
qos | 10 | specify quality of service | get | 70 | direct access to a queue |
qos-ok | 11 | confirm the requested qos | get-ok | 71 | provide client with a message |
consume | 20 | start a queue consumer | get-empty | 72 | indicate no messages available |
consume-ok | 21 | confirm a new consumer | ack | 80 | acknowledge one or more messages |
cancel | 30 | end a queue consumer | reject | 90 | reject an incoming message |
cancel-ok | 31 | confirm a cancelled consumer | recover-async | 100 | redeliver unacknowledged messages |
publish | 40 | publish a message | recover | 110 | redeliver unacknowledged messages |
return | 50 | return a failed message | recover-ok | 111 | confirm recovery |
deliver | 60 | notify the client of a consumer message |
tx (Class ID 90)
| Method | ID | Description | Method | ID | Description |
|---|---|---|---|---|---|
select | 10 | select standard transaction mode | commit-ok | 21 | confirm a successful commit |
select-ok | 11 | confirm transaction mode | rollback | 30 | abandon the current transaction |
commit | 20 | commit the current transaction | rollback-ok | 31 | confirm successful rollback |
Sample Hexdump
Protocol Header. The client MUST start a new connection by sending a protocol header. This is an 8-octet sequence:
Advanced Message Queuing Protocol
Type: Method (1)
Channel: 0
Length: 524
Class: Connection (10)
Method: Start (10)
Arguments
0000 41 4d 51 50 00 00 09 01 AMQP....
Connection.Open
Advanced Message Queuing Protocol
Type: Method (1)
Channel: 0
Length: 8
Class: Connection (10)
Method: Open (40)
Arguments
Virtual-Host: /
Capabilities:
.... ...1 = Insist: True
0000 01 00 00 00 00 00 08 00 0a 00 28 01 2f 00 01 ce ..........(./...
Reference
AMQP Wireshark Wiki
IANA search=amqp
RabbitMQ: Inspecting AMQP 0-9-1 Traffic using Wireshark
amqp-specification.zip