How to achieve Message Priority using Quorum Queues?

487 Views Asked by At

My use case requires that RabbitMQ messages are processed (consumed) according to their priority. That is, high priority messages will be processed before medium priority, and medium before low.

According to the RabbitMQ documentation, this is possible with Quorum Queues using a queue for each priority.

Specifically, the RabbitMQ documentation states:

Quorum queues support consumer priorities, but not message priorities. To prioritize messages with Quorum Queues, use multiple queues; one for each priority.

However, nothing more is said about how to implement this at the consumer level.

The only idea I have is to utilize the Rabbit "Polling" API to poll each queue in order, and only move on to a lower priority queue when no messages are returned; however, the documentation also says the Polling API is "highly inefficient and should be avoided in most cases".

Is there another approach to achieve message priorities using Quorum Queues?

1

There are 1 best solutions below

0
Randyaa On

Have each consumer consume from the highest priority queue first, then the next, then the next. To do so, call basic.consume with the same function for each queue