RabbitMQ Tutorial
Learn RabbitMQ step by step: 37 lessons in 9 chapters with examples, quizzes, diagrams and projects.
Start learning →
of lessons completed
Getting Started
- What Is RabbitMQ? Learn what RabbitMQ is, what a message broker does, how producers, queues and consumers fit together, and when RabbitMQ is the right tool.
- Messaging Concepts and Patterns Understand the core ideas behind message brokers: synchronous vs asynchronous calls, point-to-point vs publish/subscribe, delivery guarantees and idempotency.
- Installing and Running RabbitMQ Install and start RabbitMQ with Docker or a package manager, learn the default ports and the guest user, and understand AMQP connection URIs.
- Hello World: Publish and Consume Write your first RabbitMQ producer and consumer with Python pika, understand every call, and practice with a runnable in-memory stand-in broker.
- Management UI and CLI Tools Tour the RabbitMQ management UI, learn the key rabbitmqctl and rabbitmq-diagnostics commands, and read queue statistics from the HTTP API.
AMQP and Architecture
- The AMQP 0-9-1 Model Learn the AMQP 0-9-1 model used by RabbitMQ: exchanges, queues, bindings, routing keys, frames and the wire protocol, with runnable Python stand-ins.
- Connections and Channels Understand why RabbitMQ has both connections and channels, how multiplexing works, what closes a channel, and how many of each you should open.
- Message Properties and Anatomy Learn what is inside a RabbitMQ message: body, routing key, properties such as delivery_mode, correlation_id, headers and expiration, and how to serialize payloads.
- Inside the Broker: Erlang, Nodes and Storage A tour of RabbitMQ internals: Erlang processes, nodes and the metadata store, how messages are stored, and the memory and disk alarms that throttle publishers.
Queues and Exchanges
- Queues in Depth Master RabbitMQ queues: declare options, durable vs persistent, exclusive and auto-delete queues, server-named queues, FIFO behavior and consumer prefetch.
- Exchanges Overview Learn what RabbitMQ exchanges do, the four built-in types, the default and predeclared exchanges, the mandatory flag and alternate exchanges.
- Bindings and Routing Keys Understand RabbitMQ bindings: how queue_bind links exchanges to queues, the difference between routing key and binding key, multiple bindings and unbinding.
- Queue Types: Classic, Quorum and Streams Compare RabbitMQ classic queues, quorum queues and streams: how each stores data, replication and Raft majorities, and which type to choose.
- Queue Arguments: TTL, Length and Dead Letters Use RabbitMQ queue arguments and policies: message and queue TTL, length limits, overflow behavior, dead letter exchanges and the x-death header.
Routing Patterns
- The Direct Exchange Learn the RabbitMQ direct exchange: exact-match routing, multiple bindings, log severity routing with pika, and where direct exchanges fit best.
- Fanout and Publish/Subscribe Build publish/subscribe with the RabbitMQ fanout exchange: broadcasting to every bound queue, temporary subscriber queues, and fanout versus work queues.
- The Topic Exchange Master the RabbitMQ topic exchange: dotted routing keys, the * and # wildcards, worked matching examples, naming conventions and common pitfalls.
- Headers and the Default Exchange Route on message headers with the RabbitMQ headers exchange and x-match, understand the default exchange, and pick the right exchange type for each job.
Reliability and Acknowledgements
- Publisher Confirms and Returns Learn how RabbitMQ publisher confirms, the mandatory flag and basic.return tell a producer whether a message was really accepted, with pika code and a runnable simulation.
- Consumer Acknowledgements and Prefetch Understand RabbitMQ manual acknowledgements, basic.nack, requeueing, redelivery and the prefetch (QoS) limit, with pika examples and a runnable delivery simulation.
- Durability and Persistent Messages Learn what survives a RabbitMQ restart: durable exchanges and queues, delivery_mode 2 persistent messages, transient queues, lazy behavior and the full checklist for no message loss.
- Dead Letter Exchanges, TTL and Retries Learn RabbitMQ dead lettering: x-dead-letter-exchange, the x-death header, message TTL, delivery limits and the delayed retry queue pattern, with a runnable simulation.
Clustering and High Availability
- Clustering Fundamentals Learn how a RabbitMQ cluster works: nodes, the Erlang cookie, shared metadata, queue leaders, required ports, joining nodes with rabbitmqctl and why you want an odd node count.
- Quorum Queues Learn RabbitMQ quorum queues: Raft replication, leaders and followers, declaring x-queue-type quorum, delivery limit, differences from classic queues and a runnable majority-commit simulation.
- RabbitMQ Streams Learn RabbitMQ streams: append-only replicated logs, non-destructive reads, consumer offsets, retention, super streams and when to choose a stream instead of a queue.
- Network Partitions and Client Failover Learn what a RabbitMQ network partition is, how pause_minority and autoheal work, why majority protocols help, and how clients and load balancers reconnect after a node failure.
Patterns: RPC, Work Queues
- Work Queues and Fair Dispatch Build a RabbitMQ work queue with competing consumers: round-robin dispatch, fair dispatch with prefetch 1, acks, scaling workers, single active consumer, and a runnable simulation.
- RPC with Reply Queues Implement request-reply (RPC) over RabbitMQ with reply_to and correlation_id, exclusive callback queues, Direct Reply-To, timeouts and the trade-offs, with a runnable simulation.
- Publish/Subscribe and Event Fanout Design event-driven systems with RabbitMQ publish/subscribe: one queue per subscribing service, fanout and topic exchanges, competing consumers per service, event naming and the outbox pattern.
Operations and Monitoring
- Management UI, HTTP API and CLI Tools Learn to operate RabbitMQ with the management plugin, its HTTP API and the CLI tools rabbitmqctl, rabbitmq-diagnostics, rabbitmq-queues and rabbitmq-plugins, with runnable parsing examples.
- Monitoring and Prometheus Monitor RabbitMQ with the rabbitmq_prometheus plugin: key metrics for queues, consumers, memory, disk and connections, scrape setup, Grafana dashboards and practical alert rules.
- Flow Control and Resource Alarms Understand how RabbitMQ protects itself: credit-based flow control, the memory high watermark, the disk free limit, blocked connections, and how to tune and react to alarms.
- Security: Users, Virtual Hosts and TLS Secure RabbitMQ: replace the guest user, create virtual hosts, grant configure/write/read permissions with regular expressions, topic permissions, user tags and TLS listeners.
Projects and Practice
- Project: Order Processing Pipeline Design and build an event-driven order pipeline with RabbitMQ: topic exchange, per-service quorum queues, retries, a dead letter queue, publisher confirms, and a runnable mini-broker simulation.
- Project: Task Queue with Retries and Idempotency Build a reliable background-job system on RabbitMQ: durable work queue, exponential backoff retry queues, a parking lot, idempotency keys and graceful shutdown, with a runnable simulation.
- Practice: Troubleshooting Stuck Queues Practice diagnosing RabbitMQ problems from symptoms: growing ready or unacked counts, missing consumers, unroutable messages, blocked connections, redelivery loops and PRECONDITION_FAILED.
- Practice: Design Review and Pattern Choices Practice RabbitMQ architecture decisions: queue or stream, quorum or classic, work queue or pub/sub, RPC or events, and a production design checklist, with worked scenarios and runnable helpers.