Gary, The test doesn't represent the scenario I was attempting to replicate (as far as I could tell). The reason my test was failing was that in my test I was starting the consumer before putting the messages on the queue. The MesagePrirityTest.testQueues first puts messages on the queue, then starts a consumer.
When I change MesagePrirityTest.testQueues to start the queue first, it fails. When I modify my original test to start the consumer after putting the messages, as the original MesagePrirityTest.testQueues does, my test works. Should JMS Priority work with a consumer already active? Thanks in advance for any pointers. Jeremy On Thu, Feb 16, 2012 at 8:59 AM, Gary Tully <gary.tu...@gmail.com> wrote: > Have a peek at the working unit test on trunk for a comparison with > your test case: > > http://svn.apache.org/repos/asf/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/store/MessagePriorityTest.java > > On 15 February 2012 20:58, Jeremy Levy <jel...@gmail.com> wrote: > > 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 > > > > -- > http://fusesource.com > http://blog.garytully.com > -- Jeremy Levy