Hi,

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
same.

I'm using a
    <listener>
       
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>

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
consumption?

Thanks
Jon



--
View this message in context: 
http://activemq.2283324.n4.nabble.com/Pause-Resume-MessageListener-using-DefaultMessageListenerContainer-tp4655590.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to