You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Jeremy Levy <je...@gmail.com> on 2012/03/05 21:21:05 UTC
Re: JMS Priority
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 <ga...@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 <je...@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
Re: JMS Priority
Posted by Gary Tully <ga...@gmail.com>.
It the consumer is fast, then there will be no buffering and no
opportunity to order. Using prefetch of 0 may help as it will slow
down the consumer.
There was a related issue on trunk recently that may help,
https://issues.apache.org/jira/browse/AMQ-3436 it is resolved on trunk
for 5.6
On 5 March 2012 20:21, Jeremy Levy <je...@gmail.com> wrote:
> 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 <ga...@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 <je...@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
--
http://fusesource.com
http://blog.garytully.com