[rabbitmq-discuss] Implementing Prioritised Queues

Eugene Kirpichov ekirpichov at gmail.com
Thu Oct 13 12:23:09 BST 2011

Just consume both queues and internally, in your application,
implement "getting next message" as "next from your application's
buffer associated with Q1 if it's nonempty, otherwise next from Q2's

On Thu, Oct 13, 2011 at 3:17 PM, James Dear <jamesdear at gmail.com> wrote:
> Hi,
> 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.
> Thanks
> James
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

Eugene Kirpichov
Principal Engineer, Mirantis Inc. http://www.mirantis.com/
Editor, http://fprog.ru/

More information about the rabbitmq-discuss mailing list