You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by sparky2708 <da...@columbia.edu> on 2007/07/27 23:16:05 UTC

ActiveMQ onMessage() callback not async

I am finding that when I receive messages in my java client that I can only
process one request at a time. It seems like the method: onMessage(Message
arg) from MessageListener interface doesn't get called asynchronously. Do I
need to start a thread in this method to get the async behavior that I am
looking for or am I missing some option when I subscribe?
-- 
View this message in context: http://www.nabble.com/ActiveMQ-onMessage%28%29-callback-not-async-tf4160185s2354.html#a11836836
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: ActiveMQ onMessage() callback not async

Posted by sparky2708 <da...@columbia.edu>.
I wonder if this has something to do with ACKs for messages processed?


Ladlestein wrote:
> 
> If you look at the javadocs for 
> http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/MessageListener.html
> MessageListener , you'll see that the Session backing your listener won't
> call onMessage while a previous onMessage invocation has yet to return. 
> I'm puzzled why they even need to say that, though, because a 
> http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/Session.html
> Session  is a single-threaded context.  If you want concurrent message
> processing, you will need multiple threads; using multiple Sessions might
> be the way to go.  Someone else with more expertise here could say more.
> 
> 
> sparky2708 wrote:
>> 
>> I am finding that when I receive messages in my java client that I can
>> only process one request at a time. It seems like the method:
>> onMessage(Message arg) from MessageListener interface doesn't get called
>> asynchronously. Do I need to start a thread in this method to get the
>> async behavior that I am looking for or am I missing some option when I
>> subscribe?
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/ActiveMQ-onMessage%28%29-callback-not-async-tf4160185s2354.html#a11862473
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: ActiveMQ onMessage() callback not async

Posted by Ladlestein <ri...@acm.org>.
If you look at the javadocs for 
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/MessageListener.html
MessageListener , you'll see that the Session backing your listener won't
call onMessage while a previous onMessage invocation has yet to return.  I'm
puzzled why they even need to say that, though, because a 
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/jms/Session.html Session 
is a single-threaded context.  If you want concurrent message processing,
you will need multiple threads; using multiple Sessions might be the way to
go.  Someone else with more expertise here could say more.


sparky2708 wrote:
> 
> I am finding that when I receive messages in my java client that I can
> only process one request at a time. It seems like the method:
> onMessage(Message arg) from MessageListener interface doesn't get called
> asynchronously. Do I need to start a thread in this method to get the
> async behavior that I am looking for or am I missing some option when I
> subscribe?
> 

-- 
View this message in context: http://www.nabble.com/ActiveMQ-onMessage%28%29-callback-not-async-tf4160185s2354.html#a11856245
Sent from the ActiveMQ - User mailing list archive at Nabble.com.