Skip to the page

RabbitMQ · senior

RabbitMQ durability and queue types: classic, quorum and stream

Messages survive a restart only with a durable queue and persistent messages, and replication needs a quorum queue. Streams are a different tool: a log that many readers can replay.

The notes

What you must know

  • A non-durable queue is deleted when its node restarts, with every message in it. Surviving a restart needs both a durable queue and persistent messages. Classic queues are not replicated: one queue lives on one node. Mirrored queues were removed in RabbitMQ 4.0, so use quorum queues for replication.
  • While a queue does not exist, an exchange with no matching binding drops new messages. Without mandatory or an alternate exchange nobody is told, and without publisher confirms the publisher never knows if the broker took a message.
  • Quorum queue: replicated with Raft over an odd number of nodes (usually 3), durable, elects a new leader when a node dies, needs a majority to work, and has delivery limits and at-least-once dead-lettering. It costs more disk and network per message.
  • Stream: an append-only log with offsets, like a Kafka partition. Many consumers read independently from an offset or a time. Retention is by size or age. No per-message ack, requeue or dead-lettering.
  • Pick: payment commands that must not be lost, a quorum queue with persistent messages and publisher confirms. A high-volume job queue, a quorum queue with prefetch and dead-lettering (classic only if losing queued work on node failure is acceptable). An audit feed read by several teams, a stream. Declare exchanges, queues and bindings from definitions or infrastructure code, not by whichever app starts first.
  • Recover lost work from the source of truth and republish with the same ids. For critical work use an outbox in the publisher. Patch one node at a time and wait for queues to return to full membership. A two-node cluster has no majority when one node dies.

The red pen

Common traps: mistake → fix

  • Mistake: RabbitMQ never loses messages

    Fix: not with transient messages or non-durable queues.

  • Mistake: A durable queue is enough

    Fix: messages also must be persistent.

  • Mistake: Mirrored queues are the way to high availability

    Fix: they were removed; use quorum queues.

  • Mistake: A stream is a good job queue

    Fix: it has no per-message retry or dead-lettering.

Easy to hard

Questions interviewers ask, easy to hard

  1. 40,000 messages vanished after a node restart. How?
  2. Classic, quorum or stream for these three queues?
  3. What are publisher confirms?
  4. What does a quorum queue need to keep working?

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview