activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Bish <tabish...@gmail.com>
Subject Re: ActiveMQ Clustering Issue
Date Thu, 23 Aug 2012 14:12:00 GMT
On Wed, 2012-08-22 at 23:49 -0700, joesan wrote: 
> This is how my MessageListener looks like:
> 
> *public class Listener implements MessageListener {
> 
> 	public void onMessage(Message message) {
> 		try {
> 			MapMessage map = (MapMessage)message;
> 			Long msgCount = map.getLong("counter");
> 			System.out.println("Message Count Received is " + msgCount);
> 		} catch (Exception e) {
> 			e.printStackTrace();
> 		}
> 	}
> }*
> 
> The maxReconnectAttempts=-1 did not work and my Consumer will shutdown if
> the connection could not be established within 1 couple of seconds.
> 
> 
> 
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/ActiveMQ-Clustering-Issue-tp4655306p4655468.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Your consumer app is relying on the AMQ client code to always have a
non-daemon thread around to keep it alive, instead you should add some
code to your main to keep it alive and probably have something there to
let you shut it down gracefully.  When the connection fails and the
transport thread dies this will cause your app to shutdown. 

-- 
Tim Bish
Sr Software Engineer | FuseSource Corp
tim.bish@fusesource.com | www.fusesource.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/


Mime
View raw message