[rabbitmq-discuss] Possible bug in Priority Queue plugin

Simon MacMullen simon at rabbitmq.com
Wed Jul 9 10:10:08 BST 2014

I don't know SimpleAmqpClient but from your description it sounds like 
you are consuming with no prefetch limit - i.e. RabbitMQ will send your 
consumer as many messages as it likes, limited only by network speed.

Therefore messages aren't resting in the queue at all, they're sent 
straight out to the client, and there is no opportunity for higher 
priority messages to overtake lower ones.

You need to make sure messages are backing up in the queue (e.g. by 
consuming with basic.qos set to some small value like 1) to see the 
prioritising effect.

Cheers, Simon

On 08/07/2014 10:09PM, Steven Blanc wrote:
> I have been experimenting with the priority queue plugin
> (3.3.x-72d20292) with RMQ Server 3.3.2.
> I have a simple producer and a simple consumer written in C++ using
> SimplelAmqpClient.
> The consumer app creates  a Channel (SimpleAmpqClient Channel), the
> exchange, the queue (as a priority queue with x-max-priority of 10) and
> a binding.
> I see this all properly from the RMW Admin GUI.
> After that it calls BasicConsume() and then goes into a loop calling
> BasicConsumeMessage() with a 1 second sleep between calls.
> Meanwhile, the simple producer creates a broker connection, then goes
> into a loop creating messages with a priority value assigned to be
> either 0 or 10.
> Where I think I see a bug is this:
> If the consumer calls BasicConsume BEFORE the messages are in the queue,
> they are consumed in FIFO order, without consideration of the priority
> value.
> If I sleep in the consumer before calling BasicConsume() until all
> messages are in the queue, they are consumed in priority order.
> Am I doing something wrong?  Shouldn't the priority on each message
> place it in the queue according to priority over time and the already
> connected consumer(s) will get higher priority messages ahead of lower
> priority messages all the time?
> I looked at the Java example provided here:
> https://github.com/rabbitmq/rabbitmq-priority-queue/blob/master/examples/java/src/com/rabbitmq/examples/PriorityQueue.java
> I am not a Java programmer, but it appears that example also publishes
> messages to a priority queue before there is a consumer and then creates
> a consumer of the queue which retrieves messages in priority order.
> Same results I see, but not the desired behavior I am looking for.
> Should this work after a consumer is attached to a queue and consuming
> it for all subsequent messages?
> Thanks,
> Steve
> _______________________________________________
> rabbitmq-discuss mailing list has moved to https://groups.google.com/forum/#!forum/rabbitmq-users,
> please subscribe to the new list!
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

Simon MacMullen
RabbitMQ, Pivotal

More information about the rabbitmq-discuss mailing list