You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Deepak Agrawal <s....@gmail.com> on 2009/05/28 06:38:59 UTC

Concurrent message processing

I am using activeMQ 5.1 and I want my consumer to process my message
asynchronously.
Whenever any message comes to the consumer the processing of message in
onMessage method includes connectivity with database and processing database
query. So here if there is any block of code which requires more time to
process, it is delaying processing of other message. For example one message
in onMessage is taking 45 seconds to process the message and do necessary
database calls, the second message is consumed only after 45 seconds are
over.

I want concurrent consuming of message to the consumer. So that the
processing of one message should not delay the processing of another
messages in the same queue.

What will be the best way to achieve this ?
Thanks for any help.
-- 
View this message in context: http://www.nabble.com/Concurrent-message-processing-tp23755107p23755107.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Concurrent message processing

Posted by Rob Davies <ra...@gmail.com>.
Use more than one Session - or put the messages in a BlockingQueue and  
use a thread pool to process them concurrently

Rob Davies
Sent from my iPhone

On 28 May 2009, at 05:38, Deepak Agrawal <s....@gmail.com>  
wrote:

>
> I am using activeMQ 5.1 and I want my consumer to process my message
> asynchronously.
> Whenever any message comes to the consumer the processing of message  
> in
> onMessage method includes connectivity with database and processing  
> database
> query. So here if there is any block of code which requires more  
> time to
> process, it is delaying processing of other message. For example one  
> message
> in onMessage is taking 45 seconds to process the message and do  
> necessary
> database calls, the second message is consumed only after 45 seconds  
> are
> over.
>
> I want concurrent consuming of message to the consumer. So that the
> processing of one message should not delay the processing of another
> messages in the same queue.
>
> What will be the best way to achieve this ?
> Thanks for any help.
> -- 
> View this message in context: http://www.nabble.com/Concurrent-message-processing-tp23755107p23755107.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>