Learn RabbitMQ

Message broker for queues, routing and reliable asynchronous messaging

15 lessons · 3 hours · 4 levels · covers RabbitMQ 4.3

RabbitMQ is an open-source message broker: applications publish messages to exchanges, which route them into queues that consumers process at their own pace. It decouples services, smooths traffic spikes and distributes background work across workers. It speaks AMQP 0-9-1, AMQP 1.0, MQTT and its own stream protocol, and offers replicated quorum queues and streams for durable workloads.

Before you start

RabbitMQ builds on these; the tree links to the exact lessons you need.

How deep do you want to go?

1. EssentialsRead and write simple code, do the everyday basics5 lessons · 49 min in total
2. PracticalUse it productively at work, with the usual idioms9 lessons · 2 hours in total
3. AdvancedThe less common features, performance and trade-offs12 lessons · 2 hours in total
4. ExpertInternals and the edge cases experts know15 lessons · 3 hours in total

The RabbitMQ tree

RabbitMQMessage brokers and the AMQP modelMessage brokers andthe AMQP modelRunning RabbitMQ and the management UIRunning RabbitMQand the manageme…Publishing and consuming with PythonPublishing andconsuming with Pyt…Exchange types: direct, fanout, topic, headersExchange types:direct, fanout, topic…Work queues and prefetchWork queues andprefetchConsumer acknowledgements, nack and requeueConsumeracknowledgements…Designing routing with topic exchangesDesigning routingwith topic exchangesDurability, persistence and publisher confirmsDurability,persistence and pu…Dead-lettering, TTL and retriesDead-lettering, TTLand retriesRunning containers with docker runRunning containerswith docker runDefining functionsDefining functions
Essentials and Practical shown (9 of 15 lessons); the full list is below. Click a lesson to read it.

All 15 lessons, in order

Messaging basics

  1. Message brokers and the AMQP model · Essentials · 7 min

    Producers publish to exchanges, exchanges route to queues via bindings, consumers read from queues: the core RabbitMQ model.

  2. Running RabbitMQ and the management UI · Essentials · 8 min

    Start RabbitMQ with Docker, open the management UI, and use rabbitmqctl and rabbitmqadmin to inspect queues.

  3. Publishing and consuming with Python · Essentials · 12 min

    Connect with the pika client, declare a queue, publish a message and consume it with a callback.

  4. Work queues and prefetch · Essentials · 10 min

    Share tasks among several workers on one queue, and use prefetch so busy workers don't hoard messages.

Exchanges and routing

  1. Exchange types: direct, fanout, topic, headers · Essentials · 12 min

    Route messages with direct, fanout, topic and headers exchanges, and bind queues with keys and patterns.

  2. Designing routing with topic exchanges · Practical · 10 min

    Design routing keys and binding patterns for events, use exchange-to-exchange bindings and alternate exchanges.

Reliable delivery

  1. Consumer acknowledgements, nack and requeue · Practical · 12 min

    Acknowledge messages after processing, reject or requeue failures, and understand redelivery and the consumer timeout.

  2. Durability, persistence and publisher confirms · Practical · 14 min

    Survive broker restarts with durable queues and persistent messages, and make publishing reliable with publisher confirms.

  3. Dead-lettering, TTL and retries · Practical · 12 min

    Route rejected or expired messages to a dead-letter exchange, expire messages with TTL, and build delayed retries.

Queue types and administration

  1. Quorum queues · Advanced · 14 min

    Use replicated, Raft-based quorum queues for data safety, and know their delivery limit, constraints and sizing.

  2. Streams: replayable message logs · Advanced · 14 min

    Use streams for append-only, replayable logs that many consumers read from any offset without removing messages.

  3. Virtual hosts, users, permissions and policies · Advanced · 12 min

    Isolate applications with vhosts, grant least-privilege permissions, and configure queues centrally with policies.

Clusters and operations

  1. Clustering, partitions and the metadata store · Expert · 15 min

    How RabbitMQ nodes form a cluster, what is shared and what is replicated, how network partitions are handled, and how to size clusters.

  2. Flow control, alarms and monitoring · Expert · 14 min

    Understand memory and disk alarms, credit-based flow control and blocked publishers, and monitor brokers with Prometheus.

  3. Delivery guarantees, ordering and idempotency · Expert · 14 min

    What RabbitMQ really guarantees about delivery and ordering, why exactly-once is up to you, and how to design idempotent consumers.