You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Eugene Prokopiev <pr...@stc.donpac.ru> on 2006/08/21 08:18:24 UTC

Balanced reading from queue group

Hi,

Suppose I have this queues:

queue://mesages.input-0
queue://mesages.input-1
queue://mesages.input-2
...
queue://mesages.input-n

I need to read messages from every queue and process them in the same 
way. Processing will consume significant time (1s or more). Message 
incoming distribution is 1 message per 1 minute in every queue, but 
sometimes in one queue can apper about 1000 messages in short time 
period. The main demand to processing application is not delay 
processing of other queues and process big amount of messages in rest 
time. So, any round robin reading algorithm must be used in this case.

Is it possible to do it automatically with one consumer (or pool of 
consumers) which will be read from queue://mesages.> or need I create 
separate consumer for each queue to implement this behavior?

--
Thanks,
Eugene Prokopiev


Re: Balanced reading from queue group

Posted by Eugene Prokopiev <pr...@stc.donpac.ru>.
>> > Can you use parallelisation? In which case just create one consumer
>> > (in its own session) for each queue then you'l process things
>> > concurrently. Otherwise you might want to create a JMS client with a
>> > collection of consumers where you do a receive(timeout) on each queue
>> > in order to ensure fair consumption.
>>
>> I can't understand difference between two cases. In every case I need to
>> create separate thread with separate session and consumer, am I right?
> 
> 
> No - in the second case you could share a session across all consumers
> and just have 1 thread processing a message at once. i.e. the second
> case is when you only want to process one message at once

Thanks. First case is looks like more suitable for me.


Re: Balanced reading from queue group

Posted by James Strachan <ja...@gmail.com>.
On 8/21/06, Eugene Prokopiev <pr...@stc.donpac.ru> wrote:
> > Can you use parallelisation? In which case just create one consumer
> > (in its own session) for each queue then you'l process things
> > concurrently. Otherwise you might want to create a JMS client with a
> > collection of consumers where you do a receive(timeout) on each queue
> > in order to ensure fair consumption.
>
> I can't understand difference between two cases. In every case I need to
> create separate thread with separate session and consumer, am I right?

No - in the second case you could share a session across all consumers
and just have 1 thread processing a message at once. i.e. the second
case is when you only want to process one message at once
-- 

James
-------
http://radio.weblogs.com/0112098/

Re: Balanced reading from queue group

Posted by Eugene Prokopiev <pr...@stc.donpac.ru>.
> Can you use parallelisation? In which case just create one consumer
> (in its own session) for each queue then you'l process things
> concurrently. Otherwise you might want to create a JMS client with a
> collection of consumers where you do a receive(timeout) on each queue
> in order to ensure fair consumption.

I can't understand difference between two cases. In every case I need to 
create separate thread with separate session and consumer, am I right?

-- 
Thanks,
Eugene Prokopiev


Re: Balanced reading from queue group

Posted by James Strachan <ja...@gmail.com>.
Can you use parallelisation? In which case just create one consumer
(in its own session) for each queue then you'l process things
concurrently. Otherwise you might want to create a JMS client with a
collection of consumers where you do a receive(timeout) on each queue
in order to ensure fair consumption.

On 8/21/06, Eugene Prokopiev <pr...@stc.donpac.ru> wrote:
> Hi,
>
> Suppose I have this queues:
>
> queue://mesages.input-0
> queue://mesages.input-1
> queue://mesages.input-2
> ...
> queue://mesages.input-n
>
> I need to read messages from every queue and process them in the same
> way. Processing will consume significant time (1s or more). Message
> incoming distribution is 1 message per 1 minute in every queue, but
> sometimes in one queue can apper about 1000 messages in short time
> period. The main demand to processing application is not delay
> processing of other queues and process big amount of messages in rest
> time. So, any round robin reading algorithm must be used in this case.
>
> Is it possible to do it automatically with one consumer (or pool of
> consumers) which will be read from queue://mesages.> or need I create
> separate consumer for each queue to implement this behavior?
>
> --
> Thanks,
> Eugene Prokopiev
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/