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 <[EMAIL PROTECTED]> wrote:

i read the post at :
http://www.nabble.com/-activemq-user--two-threads-per-session-tf476901s2354.html#a1298138
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.
http://java.sun.com/javaee/5/docs/api/javax/jms/MessageListener.html

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: 
http://www.nabble.com/messageListener%2C-ASYNC%2C-and-threads-in-%22onMessage%28%29%22-tf3579500s2354.html#a10002299
Sent from the ActiveMQ - User mailing list archive at Nabble.com.




--

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

Reply via email to