Rabbit mQ messages moving from ready queue to Unack queue
<p>I have a separate publisher and consumer.I start publisher and publish messages.Now i start consumer and problem is that the messages move from ready queue to unack queue marking the messages as redelivered which i want to avoid.So what i want is it should be marked as redelivered only if i send ack and not on consumer restart or start </p>

<p>Configuration :</p>

<pre><code>@Bean
public org.springframework.amqp.rabbit.connection.Connection mqConnection() {
    CloudFactory cloudFactory = new CloudFactory();
    Cloud cloud = cloudFactory.getCloud();
    return cloud.getServiceConnector("mqservicename", ConnectionFactory.class,
            null).createConnection();
} 
@Bean
public StatefulRetryOperationsInterceptor interceptor() {
        return RetryInterceptorBuilder.stateful().retryOperations(retryTemplate()).recoverer(new RejectAndDontRequeueRecoverer())

            .build();
}
@Bean
public SimpleMessageListenerContainer listenerContainer() {
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
    container.setMessageListener(new MessageListenerAdapter());
    container.setAdviceChain(new Advice[] {
           interceptor()
    });

    return container;
}



@Bean
public RetryTemplate retryTemplate(){
    Map map=new HashMap&lt;Class&lt;? extends Throwable&gt;, Boolean&gt;();
    map.put(CustomException.class, true);
    RetryTemplate retryTemplate=new RetryTemplate();
    retryTemplate.setRetryPolicy(new SimpleRetryPolicy(3,map));
    return retryTemplate;
}
</code></pre>