title: @Transactional rabbit listener cause infinite loop
body: <p>Hi I have problem with my Rabbit listener which cause infinite loop on exception (requeue message). My configuration looks:</p>
  
  <pre><code>@Bean(name = "defContainer")
  public RabbitListenerContainerFactory containerFactory(ConnectionFactory connectionFactory, PlatformTransactionManager transactionManager){
      SimpleRabbitListenerContainerFactory containerFactory = new SimpleRabbitListenerContainerFactory();
      containerFactory.setConnectionFactory(connectionFactory);
      containerFactory.setConcurrentConsumers(5);
      containerFactory.setAcknowledgeMode(AcknowledgeMode.AUTO);
      containerFactory.setTransactionManager(transactionManager);
      containerFactory.setMessageConverter(messageConverterAmqp());
      containerFactory.setDefaultRequeueRejected(false);
  
      return new TxRabbitListenerContainerFactory(containerFactory);
  }
  </code></pre>
  
  <p>where transactionManager is JpaTransactionManager for transaction on postgre db.
  TxRabbitListenerContainerFactory is my factory which set setAlwaysRequeueWithTxManagerRollback to false:</p>
  
  <pre><code>public class TxRabbitListenerContainerFactory implements RabbitListenerContainerFactory {
  private SimpleRabbitListenerContainerFactory factory;
  
  public TxRabbitListenerContainerFactory(SimpleRabbitListenerContainerFactory factory) {
      this.factory = factory;
  }
  
  @Override
  public MessageListenerContainer createListenerContainer(RabbitListenerEndpoint endpoint) {
      SimpleMessageListenerContainer container = factory.createListenerContainer(endpoint);
      container.setAlwaysRequeueWithTxManagerRollback(false);
      return container;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Now I have listner like:</p>
  
  <pre><code>@RabbitListener(bindings = @QueueBinding(
          value = @Queue(value = "topic.two", durable = "true"),
          exchange = @Exchange(value = "topic.def", type = "topic", durable = "true"),
          key = "letter.*"
  ), errorHandler = "rabErrorHandler", containerFactory = "defContainer")
  @Transactional
  public Motorcycle topicLetters(Motorcycle motorcycle) throws Exception{
      motorcycle.setId(UUID.randomUUID().toString());
      Testing testing = new Testing();
      testingRepository.save(testing);
      throwEx();
      return motorcycle;
  }
  </code></pre>
  
  <p>where method <strong>throwEx();</strong> throw unchecked exception.
  Data from DB are properly rollbacked (not commited), but message are constantly requeued, see it in listener:</p>
  
  <pre><code>@Bean
  public RabbitListenerErrorHandler rabErrorHandler(){
      return new RabbitListenerErrorHandler() {
          @Override
          public Object handleError(Message message, org.springframework.messaging.Message&lt;?&gt; message1, ListenerExecutionFailedException e) throws Exception {
              System.out.println("FFFFFFFFFFF");
              return null;
          }
      };
  }
  </code></pre>
  
  <p>How to prevvent infinite loope, and why is it happend ?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Logs: <a href="http://pasted.co/d718335e" rel="nofollow noreferrer">pasted logs</a></p>