activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpcook01 <>
Subject Pause/Resume MessageListener using DefaultMessageListenerContainer
Date Mon, 27 Aug 2012 10:46:20 GMT

I am using a Asynchronous MessageListener with onMessage within a
DefaultMessageListenerContainer. My service is then deployed into tomcat.

I would like to know if there is a recommended way for
activating/deactivating my messagelistener programatically? It seems like
quite a reasonable or common use case but there doesn't appear to be any
obvious recommended approach for achieving this. The approach seems to be to
get the DefaultMessageListenerContainer from the application context and
calling the stop() method to basically stop the connection and then start
again. Or I've read just calling setMessageListener(null) might achieve the

I'm using a

So the entry point into my application is my MessageListener and wiring in
the following logic to my MessageListener onMessage method seems a bit messy
and I'm not sure if there will be some strange side affect from stopping my
connection from within an async messagelistener.

I wondered if there was a better way to do this maybe using JMX or JDNI? Or
is my suggestion the recommended approach. We don't really want to have to
start and stop the tomcat container every time we want to pause message


View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message