RabbitMQ queue types: classic vs quorum vs stream

•8 min read•RabbitMQ tutorial

RabbitMQ queue types: classic vs quorum vs stream

RabbitMQ 4.x has three queue types: classic, quorum and stream. They share the same AMQP API, so a consumer often can't tell which one it reads from, but they behave very differently when a node crashes, when a message keeps failing, or when you need to read the same data twice. This guide compares them and gives you a simple rule for picking one.

Quick answer

  • Use a quorum queue for anything you can't afford to lose: orders, payments, jobs, events between services. It is the default choice for production data in a cluster.
  • Use a classic queue for temporary, exclusive or high-churn queues where losing messages on a node failure is acceptable: reply queues, per-client notification queues, caches.
  • Use a stream when several consumers need to read the same messages, when you need to replay history, or when you have very large backlogs.

Comparison table

ClassicQuorumStream
ReplicationNone (one node)Raft, replicated to several nodesReplicated to several nodes
Survives a node lossNo, unless the node comes back with its diskYes, as long as a majority of replicas is upYes, as long as a majority of replicas is up
Durable / transientBoth (non-exclusive transient queues are deprecated)Durable onlyDurable only
Exclusive queuesYesNoNo
ConsumptionDestructive (ack removes the message)DestructiveNon-destructive: messages stay, consumers track an offset
Replay old messagesNoNoYes, from any offset or timestamp
Message TTLYesYesNo, use retention (x-max-age)
Queue length limitYes, all overflow modesYes (drop-head, reject-publish)Retention by size or age
Dead-letteringYesYes, plus an at-least-once strategyNo
Poison message handlingNo (x-delivery-count not tracked)Yes, x-delivery-limitNot applicable
PrioritiesYes, up to 255 levels (x-max-priority)Yes, two levels (normal and high)No
Global QoSYesNoNo
Typical useTemporary queues, RPC repliesWork queues, events, anything importantFan-out to many consumers, event logs, replay

The rest of the article explains the rows that matter most.

Classic queues

Classic queues are the original queue type. Since RabbitMQ 4.0 they are simpler than they used to be:

  • No more mirroring. Classic mirrored queues (the ha-mode policies) were removed in 4.0. A classic queue lives on one node. If that node's disk is lost, the messages are lost. If the node restarts, the queue is unavailable until it's back.
  • One storage format. Version 2 of the classic queue storage (CQv2) is the only one left. It keeps most messages on disk and only a small part in memory, so the old "lazy queue" mode is no longer needed and is ignored.
  • Durable or transient. A durable classic queue survives a broker restart (its persistent messages too). A transient one is deleted on restart. Non-exclusive transient queues are deprecated in 4.x, so use either a durable queue or an exclusive one.

Classic queues are still the fastest option for short-lived queues, and the only one that supports exclusive: true and auto-delete semantics well. That makes them the right choice for RPC reply queues and per-connection queues.

Quorum queues

Quorum queues are replicated with the Raft consensus algorithm. A message is confirmed to the publisher only once a majority of replicas has written it. When the leader node fails, a follower that has every confirmed message takes over. As long as most replicas are up, the queue keeps working and loses nothing.

Things quorum queues do that classic queues don't:

  • Poison message handling. Every redelivery increments the x-delivery-count header. When it reaches the delivery limit, the message is dropped or dead-lettered instead of looping forever. Since RabbitMQ 4.0 the default limit is 20. Set your own with the x-delivery-limit argument or a delivery-limit policy. See message acknowledgment explained for why requeue loops happen.
  • At-least-once dead-lettering. With x-dead-letter-strategy: at-least-once (and x-overflow: reject-publish), a message is only removed from the source queue once the dead-letter target has confirmed it. With classic queues, dead-lettering is fire-and-forget.
  • Predictable failover. No manual "promote a mirror" step, no unsynchronised mirrors.

And the trade-offs:

  • Always durable. You can't declare a non-durable or exclusive quorum queue.
  • More disk and network. Each message is written on several nodes.
  • They want a cluster. A quorum queue on a single-node broker works but brings no safety over a durable classic queue. Three nodes is the usual minimum, so that one node can fail.
  • No global QoS. Prefetch must be set per consumer, which is what most client libraries do anyway.

Streams

A stream is an append-only log. Consuming doesn't remove messages: each consumer chooses where to start (first, last, next, an offset or a timestamp) with the x-stream-offset argument, and the broker keeps data until the retention limit is reached (x-max-age, x-max-length-bytes).

Choose a stream when:

  • many consumers need the same messages (instead of one queue per consumer bound to a fanout exchange),
  • you want to replay messages after a bug fix,
  • backlogs reach millions of messages.

Streams can be used through AMQP 0-9-1 like a queue (with a prefetch and x-stream-offset), or through the dedicated stream protocol on port 5552, which is much faster. We cover them in depth in everything you need to know about RabbitMQ streams.

How to declare each queue type

The type is set once, at declaration, with the x-queue-type argument. It can't be changed later: to switch, you create a new queue and move consumers and bindings to it.

Node.js (amqplib)

await channel.assertQueue('orders', {
  durable: true,
  arguments: { 'x-queue-type': 'quorum', 'x-delivery-limit': 5 },
});
 
await channel.assertQueue('events-log', {
  durable: true,
  arguments: { 'x-queue-type': 'stream', 'x-max-age': '7D' },
});

Python (pika)

channel.queue_declare(
    queue="orders",
    durable=True,
    arguments={"x-queue-type": "quorum", "x-delivery-limit": 5},
)

Java

Map<String, Object> args = Map.of("x-queue-type", "quorum", "x-delivery-limit", 5);
channel.queueDeclare("orders", true, false, false, args);

Go (amqp091-go)

_, err := ch.QueueDeclare("orders", true, false, false, false, amqp.Table{
    "x-queue-type":     "quorum",
    "x-delivery-limit": 5,
})

C# (RabbitMQ.Client 7)

await channel.QueueDeclareAsync("orders", durable: true, exclusive: false, autoDelete: false,
    arguments: new Dictionary<string, object?> { ["x-queue-type"] = "quorum", ["x-delivery-limit"] = 5 });

Our cheat sheets for JavaScript, Python, Java, Go and C# have the rest of the API.

Making quorum the default

Instead of changing every declaration, you can set a default queue type for a virtual host. Queues declared without x-queue-type then become quorum queues:

rabbitmqctl add_vhost orders --default-queue-type quorum
# or for an existing vhost
rabbitmqctl update_vhost_metadata orders --default-queue-type quorum

Clients that declare the queue as non-durable or exclusive still get a classic queue, since a quorum queue can't be either.

Migrating from classic mirrored queues

If you upgrade from 3.x and used ha-mode policies, those queues become plain, non-replicated classic queues on 4.x. Before upgrading:

  • List the policies that set ha-mode, ha-params or ha-sync-mode, and the queues they match.
  • Decide for each queue: quorum (most of them), stream (fan-out or replay use cases) or classic (temporary data).
  • Create the new queues with a new name (or in a new virtual host), switch publishers, let consumers drain the old queue, then delete it. The shovel plugin can move leftover messages.
  • Remove the ha-* keys from your policies.

Step 1 is the painful one on a large broker, because the management UI shows policies and queues on separate pages and doesn't tell you which policy actually won for a given queue.

We go through the whole upgrade in RabbitMQ 3.x end of life: how to upgrade to 4.x.

Performance: which queue type is fastest?

It depends on the workload, so benchmark your own (rabbitmq-perf-test makes this easy). General tendencies:

  • A classic queue is usually the fastest for a single non-replicated queue, since it writes on one node only.
  • Quorum queues pay for replication: each message travels to the other replicas and must be written by a majority before it is confirmed. Throughput is lower than a classic queue and latency higher, but it stays stable during failures.
  • Streams have the highest throughput for large fan-out workloads, especially with the stream protocol, because messages are written once and read by any number of consumers.
  • All queue types are fastest when they are short. A queue with millions of messages costs memory and disk whatever its type.

FAQ

What is the default queue type in RabbitMQ?

Classic, unless the virtual host sets a different default queue type (--default-queue-type quorum) or the client passes x-queue-type.

Are quorum queues persistent?

Yes. Quorum queues are always durable, and every message is written to disk on a majority of replicas before being confirmed.

What does "persistent queue" mean in RabbitMQ?

RabbitMQ separates two things: a durable queue survives a broker restart, and a persistent message (delivery mode 2) is written to disk. You need both for a classic queue to keep messages across a restart. Quorum queues and streams are always durable and store every message on disk.

Can I change the type of an existing queue?

No. Queue arguments are fixed at declaration. Declare a new queue with the new type, move bindings and consumers, and drain the old one.

Are classic mirrored queues still supported?

No. They were removed in RabbitMQ 4.0. Use quorum queues for replicated data.

Should I use a quorum queue on a single node?

You can, and you get delivery limits and at-least-once dead-lettering, but no extra protection against disk loss. The replication benefit starts with three nodes.

Debug policies in seconds

See which policies apply to each queue, why they match, and which values are overridden.

Debug my policies

Available on Windows, Mac, and Linux.

Read more RabbitMQ tutorials

RabbitMQ health checks: CLI, HTTP API, Docker and KubernetesRabbitMQ tutorialRabbitMQ health checks: CLI, HTTP API, Docker and KubernetesCopy-paste RabbitMQ health checks. rabbitmq-diagnostics commands, /api/health endpoints, a Docker Compose healthcheck and Kubernetes probes that don't hurt your cluster.The RabbitMQ Management UI: a complete guideRabbitMQ tutorialThe RabbitMQ Management UI: a complete guideHow to enable the RabbitMQ management plugin, open the UI on port 15672 (Docker too), log in, and what each tab does, plus its limits.RabbitMQ retry queue vs dead letter queue: what's the difference?RabbitMQ tutorialRabbitMQ retry queue vs dead letter queue: what's the difference?A retry queue holds a failed RabbitMQ message before another attempt, a dead-letter queue holds it once it should no longer be processed. Learn when to use each, how to combine them, and how they differ from requeue.RabbitMQ exponential backoff: how to retry messages with increasing delaysRabbitMQ tutorialRabbitMQ exponential backoff: how to retry messages with increasing delaysHow to implement exponential backoff retries in RabbitMQ with TTL retry queues and dead-letter exchanges. Track attempts with an x-retry-count header, choose retry delays, and send final failures to a DLQ.What is AMQP? The Advanced Message Queuing Protocol explainedRabbitMQ tutorialWhat is AMQP? The Advanced Message Queuing Protocol explainedLearn what AMQP (Advanced Message Queuing Protocol) is, how it works, its core concepts, why it powers RabbitMQ, and how it compares to alternatives like MQTT, STOMP, and Kafka.Building an event bus with RabbitMQRabbitMQ tutorialBuilding an event bus with RabbitMQLearn how to design a decoupled event bus using a RabbitMQ topic exchange, with practical routing key conventions, durable queues, and animated diagrams showing message flow.