AMQP 0-9-1: The Complete Protocol
Table of Contents
AMQP 0-9-1 (Advanced Message Queuing Protocol) is the protocol that defines what a message broker is. Unlike Kafka, which is a log-based streaming system, AMQP defines a broker model: a server that accepts connections, routes messages through exchanges, and delivers them to queues. RabbitMQ is the dominant implementation, but the protocol itself specifies the full interaction model — every frame, every method, every semantic guarantee.
This series builds the protocol from the ground up. It starts with the connection model and works through every layer: channels, exchanges, queues, bindings, message properties, delivery acknowledgments, publisher confirms, QoS, and the wire format. The final chapters cover every standard messaging pattern and the failure modes that arise at each layer.
The goal is complete protocol fluency — enough to implement a compliant client, debug any delivery problem, and design any messaging topology.
Chapters #
Part 1: The Protocol Model #
- The AMQP 0-9-1 Architecture — broker model vs log model, protocol layering, virtual hosts, the entity hierarchy
- Connections — The TCP Session — protocol handshake, SASL authentication, tune negotiation, heartbeats, connection close
- Channels — Multiplexing over One Connection — channel lifecycle, channel states, error propagation, channel vs connection close
- Virtual Hosts — Isolation and Permissions — vhost boundaries, permission model, administrative separation
Part 2: Routing Infrastructure #
- Exchanges — How Messages Are Routed — direct, fanout, topic, headers exchange types; default exchange; exchange-to-exchange bindings; exchange properties
- Queues — Message Storage and Lifecycle — durable vs transient, exclusive, auto-delete; x-message-ttl, x-dead-letter-exchange, x-max-length, x-max-priority; quorum queues
- Bindings — The Routing Table — routing key matching, headers matching, binding arguments, binding lifecycle
- Messages — Properties, Headers, and Body — AMQP message structure, delivery-mode, priority, expiration, content-type, message-id, correlation-id, reply-to
Part 3: Delivery Semantics #
- Consumer Acknowledgments and Delivery Guarantees — basic.consume vs basic.get, delivery tag, basic.ack, basic.nack, basic.reject, requeue semantics, at-most-once vs at-least-once
- Publisher Confirms — Delivery Confirmation from Broker to Publisher — confirm mode, ack/nack from broker, synchronous vs asynchronous confirmation, ordering guarantees
- Prefetch and QoS — Flow Control at the Consumer — basic.qos, prefetch_count, per-channel vs per-consumer, backpressure model
Part 4: The Wire Protocol #
- Wire Format and Framing — frame types (method, header, body, heartbeat), frame header, method encoding, content framing, max-frame-size
Part 5: Patterns #
- Messaging Patterns — work queues, publish/subscribe, selective routing, topic routing, RPC with reply-to and correlation-id, dead letter exchanges, priority queues
Part 6: Operations #
- Failure Modes and What They Mean — connection drop recovery, channel-level errors, unroutable messages, message loss scenarios, consumer cancellation, RabbitMQ cluster partitions