title: RabbitMQ with Spring redelivering message forever
body: <p>I'm using Spring with RabbitMQ and I'm trying to avoid the message redelivery in case of a runtime exception occurs. I've tried to set the <code>requeue-reject</code> to <code>false</code> in <code>listener-container</code> and configure a custom error handler that throws an <code>AmqpRejectAndDontRequeueException</code>. It seems that both of strategies failed and the message continue redelivery forever. Any ideas of the reason?</p>
  
  <p>Thank's for help.</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rabbit="http://www.springframework.org/schema/rabbit" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/rabbit http://www.springframework.org/schema/rabbit/spring-rabbit-1.1.xsd"&gt;
  
      &lt;rabbit:connection-factory id="rabbitMQConnectionFactory" host="localhost" port="5672" username="guest" password="guest" /&gt;
  
      &lt;rabbit:admin connection-factory="rabbitMQConnectionFactory" /&gt;
  
      &lt;rabbit:template id="amqpTemplate" connection-factory="rabbitMQConnectionFactory" /&gt;
  
      &lt;rabbit:queue name="q1" /&gt;
      &lt;rabbit:queue name="q2" /&gt;
  
      &lt;rabbit:listener-container error-handler="errorHandler" connection-factory="rabbitMQConnectionFactory" concurrency="10" transaction-manager="transactionManager" requeue-rejected="false"&gt;
          &lt;rabbit:listener ref="q1Listener" method="consumeMessage" queue-names="q1" /&gt;
          &lt;rabbit:listener ref="q2Listener" method="consumeMessage" queue-names="q2" /&gt;
      &lt;/rabbit:listener-container&gt;
  
      &lt;bean id="errorHandler" class="ErrorHandler" /&gt;
  
      &lt;bean id="q1Listener" class="Q1MessageConsumerBean" /&gt;
      &lt;bean id="q2Listener" class="Q2MessageConsumerBean" /&gt;
  &lt;/beans&gt;
  </code></pre>