title: RabbitMq RepublishMessageRecover ignore ImmediateAcknowledgeAmqpException
body: <p>Im creating a RabbitMQ consumer using...</p>
  
  <pre><code>&lt;dependency&gt;
    &lt;groupId&gt;org.springframework.amqp&lt;/groupId&gt;
    &lt;artifactId&gt;spring-rabbit&lt;/artifactId&gt;
    &lt;version&gt;2.2.1.RELEASE&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>My Listener looks like this...</p>
  
  <pre><code>@RabbitListener(queues = "queue")
  public void getMessages(String message) {
      if(message.contains("error")) {
         throw new ImmediateAcknowledgeAmqpException("Invalid message, discarding");
      }
      throw new AmqpRejectAndDontRequeueException("Re-queuing message");
  }
  </code></pre>
  
  <p>Im expecting <code>ImmediateAcknowledgeAmqpException</code> to discard the message totally but it keeps ending up on the deadletter queue :( Heres my configuration</p>
  
  <pre><code>@Bean
  public RepublishMessageRecoverer republishMessageRecoverer(RabbitTemplate rabbitTemplate) {
      RepublishMessageRecoverer republishMessageRecoverer = new RepublishMessageRecoverer(rabbitTemplate,"exchange", "deadletter_routing_key");
      return republishMessageRecoverer;
  }
  
  Bean
  public SimpleRetryPolicy simpleRetryPolicy() {
     Map&lt;Class&lt;? extends Throwable&gt;, Boolean&gt; includeExceptions = new HashMap&lt;&gt;();
     includeExceptions.put(ImmediateAcknowledgeAmqpException.class, false);
     includeExceptions.put(AmqpRejectAndDontRequeueException.class, true);
     return new SimpleRetryPolicy(5, includeExceptions, true);
  }
  
  @Bean
  public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(ConnectionFactory connectionFactory,
    SimpleRetryPolicy simpleRetryPolicy, RepublishMessageRecoverer republishMessageRecoverer) {
    SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
    factory.setConnectionFactory(connectionFactory);
    factory.setDefaultRequeueRejected(false);
    factory.setAdviceChain(RetryInterceptorBuilder
      .stateless()
      .retryPolicy(simpleRetryPolicy)
      .recoverer(republishMessageRecoverer)
      .backOffOptions(5000, 1,
          1000)
      .build());
     return factory;
  }
  </code></pre>
  
  <p>Is there a way I can exclude the <code>ImmediateAcknowledgeAmqpException</code> from the recoverer?</p>
  
  <p>Thanks</p>