I'm attempting to test JMS Priority with ActiveMQ 5.5.1 without much
success and was hoping someone could point out something I am missing.

My test case consists of putting 1000 messages on a queue with a priority
(being set on both the producer and the message) of 0. Followed by putting
100 messages on the queue with a priority of 9. Then start the queue and
print out the value of a TextMessage which also includes the priority in a
String simply for debugging purposes.

The result is that I see 1000 messages with the low priority followed by
the 100 messages of high priority. Whereas I would assume I'd see the 100
high priority messages mixed it with the 1000 low priority rather then just
being processed sequentially as they were added to the queue.

The broker is a fresh install of ActiveMQ, I've only made the following
configuration change in activemq.xml:

...
 <policyEntry queue=">" prioritizedMessages="true"
useConsumerPriority="true">
...


When I create the queue, I'm using the following parameter
"?consumer.prefetchSize=5", with the assumption that
the prioritization happens in the broker, and a prefetched message will
process once it's at the consumer regardless of prioritization.

I based my configuration mainly on:

http://activemq.apache.org/how-can-i-support-priority-queues.html

Can anyone see what I am missing here?

Jeremy

Reply via email to