[rabbitmq-discuss] Possible bug in Priority Queue plugin

Steven Blanc steven.blanc at avid.com
Tue Jul 8 22:09:08 BST 2014


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140708/a7027dfd/attachment.html>


More information about the rabbitmq-discuss mailing list