[rabbitmq-discuss] Implementing Prioritised Queues

James Dear jamesdear at gmail.com
Thu Oct 13 12:17:38 BST 2011


Referring back to a thread active in Feb, it seems the recommended way
to implement a priority queue is to have multiple queues, one for each
priority level:

> The usual way of implementing priorities is to use separate queues for
> each priority. So if you need two priority levels then declare queues Q1
> and Q2. Route messages to those queues based on priority and have
> clients consume from queues in that order. So Q2 messages won't be
> consumed unless Q1 is empty.

How do you actually implement the logic "consume Q2 iff Q1 empty else
consume Q1"? I've read through much of the docs but can't see anything
other than using GET, but I thought I read somewhere that GET was much
slower than CONSUME.

Can anyone help me with this? By the way, I'm writing in python/pika,
although any language example would help me.



More information about the rabbitmq-discuss mailing list