RabbitMQ and message priority

rabbitmq

Solution

The answers on this question are out-of-date. As of RabbitMQ 3.5.0, there is now in-core support for AMQP standard per-message priorities. The documentation has all the gory details, but in short:

- You need to define the queue's priority range at the time the queue is created;

- Messages without a priority set get a priority of 0;

- Messages with a numeric priority higher than the maximum set on the queue get the highest priority the queue supports.

More interesting caveats are in the docs. It's well worth reading them.

Problem

Does RabbitMQ have any concept of message priority? I have an issue where some more important messages are being slowed down due to less important messages sitting before them in the queue. I want the high-priority ones to take precedence and move to the front of the queue. I know I can approximate this using two queues, a "fast" queue and a "slow" queue, but that seems like a hack. Does anyone know of a better solution using RabbitMQ?

Original source

Related problems