The <jms:listener-container>
populates AbstractJmsListeningContainer
beans for each <jms:listener>
sub-element configuration. That container may be registered with explicit id
.
From other side the AbstractJmsListeningContainer
implements SmartLifecycle
. So you can start/stop
any Listener Container (with its Listener) any time by that id
attribute:
beanFactory.getBean("myListener", Lifecycle.class).stop();
After stopping of the Listener Container, your Listener stops to consume messages from queue.