When I wrote about the quorum queue arguments we chose, one argument from the classic queue days was missing: x-max-priority. Quorum queues did not support message priority at the time, so the priority property our publishers set on a few events was silently ignored. I never went back to check whether that had changed.

It had, twice. RabbitMQ 4.0 gave quorum queues two priority buckets with weighted dispatch, and 4.3 replaced that with 32 strict levels. I only noticed the second change while reading the 4.3.0 release notes for the upgrade that also changed how the delivery limit is counted. Both come from the same pull request, #13885.

Quorum queues now support strict priority queues with per-priority message counts, correct redelivery ordering across priorities, and priority-aware message expiration scans.

This post is the result, verified against the broker source at v4.2.4 and v4.3.6.

Three generations of priority

VersionLevelsDispatch
Before 4.0noneFIFO, priority ignored
4.0 to 4.2two buckets: 0 to 4 and 5 and aboveweighted, about 2 high for every 1 normal
4.3 and later32 levels, 0 to 31, higher values clamped to 31strict, highest level first

Two things hold from 4.0 on. There is no declaration argument: x-max-priority belongs to classic queues, and although the docs say quorum queues ignore it, the broker rejects the declaration with PRECONDITION_FAILED: invalid arg 'x-max-priority', on 4.2 and 4.3 alike. And a message without a priority property counts as priority 4, not 0 as on classic queues.

Classic queues support up to 255 levels, but only after you declare x-max-priority, and the docs recommend using from 2 to 4 priorities.

Weighted in 4.0, strict in 4.3

The 4.0 implementation (rabbit_fifo_q) keeps a high and a normal queue and a dequeue counter. On two out of every three dequeues it takes the high queue if there is anything in it. On the third it compares the oldest message of each queue and takes the older one, which during a backlog is usually the normal one. So high priority went first most of the time, but a normal message could not be held back for long.

The 4.3 implementation (rabbit_fifo_pq) keeps one queue per level and a bitmap to find the highest non-empty one. There is no counter and no compromise: as long as a higher level has a message, lower levels wait.

What strict priority changes for you

Lower priorities can starve. This is the point of strict priority, and it is also the risk. If your high priority traffic can sustain itself for minutes, everything below it stops moving for those minutes. On 4.2 it would have slowed to a third. The management UI now shows a message count per priority level, so a growing count on a low level while a high level stays busy is the symptom to look for.

An explicit 0 is now below the default. On 4.2 both 0 and “no priority” landed in the normal bucket. On 4.3, a message published with priority: 0 sorts below every message that was published without a priority at all, because those count as 4. If some publishers set 0 thinking of it as “normal”, they are now last in line.

Everything above 31 is the same. A publisher that sets 40 and one that sets 255 are no longer different once you cross 31. If you used wide gaps on classic queues to leave room for later, the room ends at 31.

The switch happens after the last member is upgraded. The new dispatch is part of a new version of the quorum queue state machine, and a queue only moves to it once every one of its members reports supporting it. During a rolling upgrade a queue keeps the weighted dispatch until its last node is on 4.3.

Two things did not change, but they matter more under strict ordering:

Returned messages jump the line, with no priority. When a message is returned to the queue by a reject, nack or consumer failure, it goes to a separate returns queue. That queue is drained before any priority level, in the order the messages were returned. A requeued priority 0 message is delivered before a fresh priority 31 one.

Prefetch still wins. Priority only decides which message the queue hands out next. A consumer that already holds a full prefetch of low priority messages processes them before it sees the high priority one that arrived a second later. If priority matters, keep the prefetch count small on that queue.

Checking what you publish

We tag the message priority on the consumer span, so one query grouped by that tag told me what our publishers actually use: a handful of time-sensitive event types at 10, everything else at an explicit 0. That is the behaviour we wanted when we set those priorities years ago, before quorum queues honoured them, so the strict version is an improvement for us. The same check is worth running before you upgrade:

  1. List the distinct priority values your publishers set, per message type. A span tag or a log field on the consumer side is the easiest source.
  2. For each queue, compare the publish rate of the top level with the consumer throughput. If the top level alone can keep up with your consumers, the levels below it have no bound on how long they wait.
  3. Decide whether strict is what you want. There is no broker knob between strict and FIFO, so the levers are the values your publishers set (the same value everywhere, or none, gives you FIFO), the consumer prefetch, or separate queues when you want the levels to share throughput.
  4. If you are converting classic priority queues, drop x-max-priority from the declaration first (.maxPriority(...) in Spring AMQP), or the declare fails.

Takeaways

  1. Quorum queues have honoured priority since 4.0 and dispatch strictly since 4.3, with no declaration argument either way.
  2. Strict means lower levels can starve. If the top level can keep up with your consumers on its own, the rest waits indefinitely.
  3. The default priority is 4, so publishing an explicit 0 puts you below messages that set nothing.
  4. Returned and prefetched messages ignore priority, and the new dispatch only starts once every member of the queue is on 4.3.

Your broker version and client library will differ from ours, so test the ordering on your own setup before relying on it.

Happy coding!