[rabbitmq-discuss] RabbitMQ - how to consume priority messages?

Michael Klishin mklishin at gopivotal.com
Fri Oct 25 13:42:48 BST 2013

On 25 Oct 2013, at 16:24, Rajasekhar P <sekhar434145 at gmail.com> wrote:

> I want to know how to consume priority messages, let say the scenario, in a queue there are 100 messages already exist but when 101th message comes into the queue which is having more priority than existing messages, in this case I want consume 101th message. How to achieve this? Is this behavior exist in RabbitMQ?

RabbitMQ messages have a priority field but RabbitMQ itself currently does not use it.

You can use multiple queues for different priorities (say, mail1 though mail5) and make
publishers publish messages such that they end up in one of the queues depending
on message priority. Then to consume higher priority messages faster you need to combine
application-level logic with higher basic.qos setting for channels that use higher priority queues
(so they are given messages faster, on average).


More information about the rabbitmq-discuss mailing list