activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: messageListener, ASYNC, and threads in "onMessage()"
Date Mon, 16 Apr 2007 07:46:03 GMT
A JMS provider will only invoke a MessageListener on a JMS
MessageConsumer by one thread at once. Indeed; a JMS provider will
invoke the MessageListener on all MessageConsumer's in a given Session
by a single thread at once.

On 4/15/07, robr <> wrote:
> i read the post at :
> which suggests an extra thread around the onMessage dispatcher. We have
> occaisional issues in the scope of our 3.1 implementation of "onMessage()"
> that could be cause by non-thread-safe code on a file Access. These could be
> issues that only come up when the broker gets very busy as they affect only
> 5 - 10% of our message flow.
> I dont completely understand whether there are , in fact , multiple threads
> that call onMessage? The javax.jms api says there is only 1.
> Other posts suggest that when using listeners and ASYNC that you should be
> prepared to have a 2nd onMessage call dispatched before the prior call has
> finished. So , your call stak from onMessage should be thread-safe.
> I've decided to review the code and to make sure that we are not throwing
> exceptions in the scope of "onMessage" and to protect the obvious objects in
> case there is m-thread issue... but i dont really know...
> comments appreciated
> --
> View this message in context:
> Sent from the ActiveMQ - User mailing list archive at



View raw message