title: Spring AMQP - Duplicate messages
body: <p>I am processing a high volume stream ~ 500+ msgs per second, The data is consumed off Spring AMQP+Rabbit using a SimpleMessageListenerContainer with 10 concurrent consumers, I have to do some checks on the Db every 15 mins and reload certain properties for processing, this is done with a quartz trigger which fires every 15 mins, stops the SimplelistenerContainer, does the necessary work and starts the Container once again.</p>
  
  <p>Everything works perfectly when the app starts up, when the trigger fires and the Container restarts, I see the same message being delivered multiple times,this causes a lot of duplicates. There are no exeptions thrown by the consumers. </p>
  
  <p><strong>The Message Listener</strong></p>
  
  <pre><code> class RoundRobinQueueListener implements MessageListener {
  
  @Override
  public void onMessage(Message message) { //do processing
       }
  
    }
  </code></pre>
  
  <p><strong>During app startup set up parallel consumers and start the consumer</strong></p>
  
  <pre><code>final SimpleMessageListenerContainer messageListenerContainer = new SimpleMessageListenerContainer(connectionFactory);
         RoundRobinQueueListener roundRobinListener = RoundRobinQueueListener.class.newInstance();
          messageListenerContainer.setQueueNames(queueName);
          messageListenerContainer.setMessageListener(roundRobinListener);
          messageListenerContainer.setConcurrentConsumers(10);
          messageListenerContainer.setChannelTransacted(true);
  </code></pre>
  
  <p><strong>The quartz trigger</strong></p>
  
  <pre><code>    void execute(JobExecutionContext context) throws JobExecutionException {
      messageListenerContainer.stop()
      //Do db task, other processing
      messageListenerContainer.start()
      }
  </code></pre>