You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Christian Schneider <ch...@die-schneider.net> on 2009/10/19 20:04:47 UTC
Camel and jms priority
I would like to configure a jms endpoint so it will consume messages by
their priority.
For example it should first consume all messages with priority 0 before
it consumes the first message with priority 1.
Is this possible and if yes how do I configure it?
Greetings
Christian
--
Christian Schneider
---
http://www.liquid-reality.de
Re: Camel and jms priority
Posted by Christian Schneider <ch...@die-schneider.net>.
James Strachan schrieb:
> 2009/10/19 Christian Schneider <ch...@die-schneider.net>:
>
>> I would like to configure a jms endpoint so it will consume messages by
>> their priority.
>> For example it should first consume all messages with priority 0 before it
>> consumes the first message with priority 1.
>>
>> Is this possible and if yes how do I configure it?
>>
>
> I'd recommend using selectors; have some consumers just do high
> priority stuff and a smaller number of consumers process anything.
>
> Here's an FAQ detailing the various options...
> http://activemq.apache.org/how-can-i-support-priority-queues.html
>
>
>
Hi James,
this is probably a very good solution for most cases. Most of all I
think it is easy to setup in camel.
The interesting thing about the solution is that a high priority
message is in general processed faster than a low priority message but
does not block low priority messages. In most
cases this is probably what is needed.
The first case I have though is a consumer that can only work single
threaded. So I think in this case the solution claus proposed can be
used. I also think about using a database to buffer the messages. As you
can then easily order the messages by "priority, time".
Thanks for the help
Christian
--
Christian Schneider
---
http://www.liquid-reality.de
Re: Camel and jms priority
Posted by James Strachan <ja...@gmail.com>.
2009/10/19 Christian Schneider <ch...@die-schneider.net>:
> I would like to configure a jms endpoint so it will consume messages by
> their priority.
> For example it should first consume all messages with priority 0 before it
> consumes the first message with priority 1.
>
> Is this possible and if yes how do I configure it?
I'd recommend using selectors; have some consumers just do high
priority stuff and a smaller number of consumers process anything.
Here's an FAQ detailing the various options...
http://activemq.apache.org/how-can-i-support-priority-queues.html
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://fusesource.com/
Re: Camel and jms priority
Posted by Claus Ibsen <cl...@gmail.com>.
On Tue, Oct 20, 2009 at 11:13 PM, Christian Schneider
<ch...@die-schneider.net> wrote:
> Hi Claus,
>
> the solution you described sounds good. The only thing is that it has to be
> coded. I had hoped that either the jms providers or camel already had a
> solution that only needs to be configured.
> But it doesn´t sound too difficult. I was also thinking about using a
> database as a buffer. But on a second thought what you propose is not much
> more difficult and does not need additional infrastructure.
>
Well it shouldn't take more than 10 lines of code to do :)
Only issue is that if in the mean time a new JMS message arrives that
have a highest priority, what then?
And as we love contributions in Apache Camel we can maybe get the code
into the camel-jms component :)
Yeah using a DB seems overkill. Then you also got the hazzle to
store/load the data and map it back/forth.
> Thanks
>
> Christian
>
>> Ask at the AMQ forum as its a JMS question how or if that is possible.
>>
>> The solution I can think off is using SQL selectors.
>>
>> And maybe use a scheduled polling approach where you can use the
>> consumer template to try select messages with the lowest priority and
>> drain the queue and then go on with +1 priority.
>>
>
> --
>
> Christian Schneider
> ---
> http://www.liquid-reality.de
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus
Re: Camel and jms priority
Posted by Christian Schneider <ch...@die-schneider.net>.
Hi Claus,
the solution you described sounds good. The only thing is that it has to
be coded. I had hoped that either the jms providers or camel already had
a solution that only needs to be configured.
But it doesn´t sound too difficult. I was also thinking about using a
database as a buffer. But on a second thought what you propose is not
much more difficult and does not need additional infrastructure.
Thanks
Christian
> Ask at the AMQ forum as its a JMS question how or if that is possible.
>
> The solution I can think off is using SQL selectors.
>
> And maybe use a scheduled polling approach where you can use the
> consumer template to try select messages with the lowest priority and
> drain the queue and then go on with +1 priority.
>
--
Christian Schneider
---
http://www.liquid-reality.de
Re: Camel and jms priority
Posted by Claus Ibsen <cl...@gmail.com>.
On Mon, Oct 19, 2009 at 8:04 PM, Christian Schneider
<ch...@die-schneider.net> wrote:
> I would like to configure a jms endpoint so it will consume messages by
> their priority.
> For example it should first consume all messages with priority 0 before it
> consumes the first message with priority 1.
>
> Is this possible and if yes how do I configure it?
>
Ask at the AMQ forum as its a JMS question how or if that is possible.
The solution I can think off is using SQL selectors.
And maybe use a scheduled polling approach where you can use the
consumer template to try select messages with the lowest priority and
drain the queue and then go on with +1 priority.
> Greetings
>
> Christian
>
> --
>
> Christian Schneider
> ---
> http://www.liquid-reality.de
>
>
--
Claus Ibsen
Apache Camel Committer
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus