You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by James Strachan <ja...@gmail.com> on 2007/06/07 13:12:52 UTC

Re: Future support for message priority in ActiveMQ?

On 5/30/07, ender <gd...@hotmail.com> wrote:
>
> Hello,
>
> While I'm aware that ActiveMQ currently does not support message priority, I
> was wondering if there were any plans to include it in a future release?

Its on the list of JIRA issues so at some point will be tackled;
though like anything else, we welcome patches...

http://activemq.apache.org/contributing.html

Incidentally if you just want to be able to reorder queues using
priority (or indeed any other kind of mechanism for sorting messages)
you can use the Resequencer...
http://activemq.apache.org/camel/resequencer.html

which works great with ActiveMQ (as well as all other JMS providers
and other components)
http://activemq.apache.org/camel/components.html


> The reason I'm asking is that we would really need a JMS implementation with
> priority support for our project. I'm aware that it is possible to implement
> some form of priority with message selectors, but this is not very feasible
> in our case, since we our queues have a single, fixed message consumer,
> which decides when it will consume the next message from the queue. The next
> message should be the one with the highest priority on the queue.

Just pop the resequencer in between the producer and consumer queue;
then you can finely control how the priority ordering works etc. e.g.
you can use complex expressions/rules for sorting things etc. Such as
using JMSPriority first, then by some other header.

In Camel...

from("activemq:producerQueue").
  resequencer(header("JMSPriority"), header("MyHeader")).
  to("activemq:consumerQueue");



-- 
James
-------
http://macstrac.blogspot.com/

Re: Future support for message priority in ActiveMQ?

Posted by James Strachan <ja...@gmail.com>.
On 27/11/2007, y7mn2 <to...@gmail.com> wrote:
>
> Thanks for reply. Currently, I am not quite sure which way to go for
> prioritizing the message:
> * either using resequencer or
> * using the selector by making the concurrent threads and pool large for
> high priority and vice versa.
>
> Is there any other way to do the message prioritizing?

The only other approach I can think of is Content Based Router so that
you put all low priority stuff on a separate queue that can be
consumed from time to time by separate consumers.
http://activemq.apache.org/camel/content-based-router.html


You could do a bit of both approaches I guess; have some
only-high-priority consumers and then resequence the rest of the
messages to try reduce the likelihood of low priority stuff slowing
things down.

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: Future support for message priority in ActiveMQ?

Posted by y7mn2 <to...@gmail.com>.
Thanks for reply. Currently, I am not quite sure which way to go for
prioritizing the message:
* either using resequencer or 
* using the selector by making the concurrent threads and pool large for
high priority and vice versa.

Is there any other way to do the message prioritizing?

Cheers,

-Tony



James.Strachan wrote:
> 
> On 27/11/2007, y7mn2 <to...@gmail.com> wrote:
>>
>>
>>
>> >
>> > Just pop the resequencer in between the producer and consumer queue;
>> > then you can finely control how the priority ordering works etc. e.g.
>> > you can use complex expressions/rules for sorting things etc. Such as
>> > using JMSPriority first, then by some other header.
>> >
>> > In Camel...
>> >
>> > from("activemq:producerQueue").
>> >   resequencer(header("JMSPriority"), header("MyHeader")).
>> >   to("activemq:consumerQueue");
>> >
>>
>>
>> Hi James,
>>
>> regarding the resequencer above. Does it actually re-sort the message
>> already in cosumerQueue?
> 
> It consumes the messages, sorts then and sends them to another
> destination. So you'd typically use 2 queues - an input queue and an
> output queue.
> 
> 
>> For example: Msg A(priority=2), B(p=6), C(p=8) then those 3 messages will
>> be
>> sort and put it back onto
>> consumerQueue in this order: Msg C, B, A...
>>
>> and if there is another 3 more message comes in like Msg D (p=5), E(8)
>> and
>> F(2), will the consumerQueue resort to: Msg C, E, B, D, A, F? or Msg C,
>> B,
>> A, E, D, F?
> 
> It depends on the configuration; the resequencer works in batches with
> timeouts; so provided the messages arrive within a given time period
> and the batch size is large enough - yes.  You can define how long to
> wait without receiving any more messages - or the maximum batch size.
> 
> e.g. if all those 6 messages arrive within a second; then yes -
> otherwise it'd sort the 2 batches of 3 messages separately.
> 
> -- 
> James
> -------
> http://macstrac.blogspot.com/
> 
> Open Source Integration
> http://open.iona.com
> 
> 

-- 
View this message in context: http://www.nabble.com/Future-support-for-message-priority-in-ActiveMQ--tf3839194s2354.html#a13968864
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Future support for message priority in ActiveMQ?

Posted by James Strachan <ja...@gmail.com>.
On 27/11/2007, y7mn2 <to...@gmail.com> wrote:
>
>
>
> >
> > Just pop the resequencer in between the producer and consumer queue;
> > then you can finely control how the priority ordering works etc. e.g.
> > you can use complex expressions/rules for sorting things etc. Such as
> > using JMSPriority first, then by some other header.
> >
> > In Camel...
> >
> > from("activemq:producerQueue").
> >   resequencer(header("JMSPriority"), header("MyHeader")).
> >   to("activemq:consumerQueue");
> >
>
>
> Hi James,
>
> regarding the resequencer above. Does it actually re-sort the message
> already in cosumerQueue?

It consumes the messages, sorts then and sends them to another
destination. So you'd typically use 2 queues - an input queue and an
output queue.


> For example: Msg A(priority=2), B(p=6), C(p=8) then those 3 messages will be
> sort and put it back onto
> consumerQueue in this order: Msg C, B, A...
>
> and if there is another 3 more message comes in like Msg D (p=5), E(8) and
> F(2), will the consumerQueue resort to: Msg C, E, B, D, A, F? or Msg C, B,
> A, E, D, F?

It depends on the configuration; the resequencer works in batches with
timeouts; so provided the messages arrive within a given time period
and the batch size is large enough - yes.  You can define how long to
wait without receiving any more messages - or the maximum batch size.

e.g. if all those 6 messages arrive within a second; then yes -
otherwise it'd sort the 2 batches of 3 messages separately.

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com

Re: Future support for message priority in ActiveMQ?

Posted by y7mn2 <to...@gmail.com>.


> 
> Just pop the resequencer in between the producer and consumer queue;
> then you can finely control how the priority ordering works etc. e.g.
> you can use complex expressions/rules for sorting things etc. Such as
> using JMSPriority first, then by some other header.
> 
> In Camel...
> 
> from("activemq:producerQueue").
>   resequencer(header("JMSPriority"), header("MyHeader")).
>   to("activemq:consumerQueue");
> 
 

Hi James, 

regarding the resequencer above. Does it actually re-sort the message
already in cosumerQueue?
For example: Msg A(priority=2), B(p=6), C(p=8) then those 3 messages will be
sort and put it back onto
consumerQueue in this order: Msg C, B, A...

and if there is another 3 more message comes in like Msg D (p=5), E(8) and
F(2), will the consumerQueue resort to: Msg C, E, B, D, A, F? or Msg C, B,
A, E, D, F?


Cheers,

-Tony 
-- 
View this message in context: http://www.nabble.com/Future-support-for-message-priority-in-ActiveMQ--tf3839194s2354.html#a13964167
Sent from the ActiveMQ - User mailing list archive at Nabble.com.