title: Start and Stop JMS Listener using Spring
body: <p>So question is how to temporary stop and start a jms listener created using spring using the fallowing way :</p>
  
  <pre><code>&lt;amq:connectionFactory id="exampleJmsFactory" brokerURL="tcp://${jms.broker.url}" /&gt;
  
  &lt;jms:listener-container concurrency="1" connection-factory="exampleJmsFactory"  destination-type="queue" message-converter="exampleMessageConverter"&gt;
          &lt;jms:listener destination="incoming.example.client.queue" ref="exampleProductsMessageConsumer" method="consume"/&gt;
  &lt;/jms:listener-container&gt;
  
  
  &lt;bean id="exampleProductsMessageConsumer" class="com.unic.example.jms.receive.JmsExampleProductsMessageConsumer" scope="tenant"/&gt;
  </code></pre>
  
  <p>So basically what is the problem. We do have an init/update mechanism that the client can run in any time and durring this init/update I want to stop consuming of ANY messages because the system is unusable in this time and if a message came it will be lost. </p>
  
  <p>So how I can stop the listener or the listener container or the whole connection using the API. I found that a class AbstractJmsListeningContainer  have stop/start but how I can get it ? I mean none of this jms: listener and listener-containers have a name or anything like that.</p>