title: Spring AMQP StatefulRetryOperationsInterceptor not used
body: <p>I am trying configure spring amqp to only retry a message a defined amount of times. Currently a message that fails e.g. because of a <code>DataIntegrityViolationException</code>  is redelivered indefinitely.</p>
  
  <p>According to the documentation <a href="http://docs.spring.io/spring-amqp/reference/htmlsingle/#retry" rel="nofollow">here</a> I came up with the following configuration</p>
  
  <pre><code>@Bean
      public StatefulRetryOperationsInterceptor statefulRetryOperationsInterceptor() {
          return RetryInterceptorBuilder.stateful()
                  .backOffOptions(1000, 2.0, 10000) // initialInterval, multiplier, maxInterval
                  .maxAttempts(3)
                  .messageKeyGenerator(message -&gt; UUID.randomUUID().toString())
                  .build();
      } 
  </code></pre>
  
  <p>This does not seem to be applied - the messages are still tried indefinitely.</p>
  
  <p>Feels like I am missing something here.</p>
  
  <p>Here is my remaining configuration regarding AMQP:</p>
  
  <pre><code>@Bean
      Queue testEventSubscriberQueue() {
          final boolean durable = true;
          return new Queue("testEventSubscriberQueue", durable);
      }
  
      @Bean
      Binding binding(TopicExchange topicExchange) {
          return BindingBuilder.bind(testEventSubscriberQueue()).to(topicExchange).with("payload.event-create");
      }
  
      @Bean
      SimpleMessageListenerContainer messageListenerContainer(ConnectionFactory connectionFactory, MessageListenerAdapter listenerAdapter) {
          SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
          container.setConnectionFactory(connectionFactory);
          container.setQueueNames(testEventSubscriberQueue().getName());
          container.setMessageListener(listenerAdapter);
          container.setChannelTransacted(true);
          return container;
      }
  
  
      @Bean
      MessageListenerAdapter listenerAdapter(MessageConverter messageConverter, SubscriberHandler subscriberHandler) {
          MessageListenerAdapter listenerAdapter = new MessageListenerAdapter(subscriberHandler);
          listenerAdapter.setMessageConverter(messageConverter);
          return listenerAdapter;
      }
  
      @Bean
      public MessageConverter messageConverter(ObjectMapper objectMapper) {
          final Jackson2JsonMessageConverter jsonMessageConverter = new Jackson2JsonMessageConverter();
          jsonMessageConverter.setJsonObjectMapper(objectMapper);
          DefaultClassMapper defaultClassMapper = new DefaultClassMapper();
          defaultClassMapper.setDefaultType(EventPayload.class);
          jsonMessageConverter.setClassMapper(defaultClassMapper);
          final ContentTypeDelegatingMessageConverter messageConverter = new ContentTypeDelegatingMessageConverter(jsonMessageConverter);
          messageConverter.addDelgate(MessageProperties.CONTENT_TYPE_JSON, jsonMessageConverter);
          return messageConverter;
      }
  
      @Bean
      public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory, MessageConverter messageConverter) {
          RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
          rabbitTemplate.setMessageConverter(messageConverter);
          //rabbitTemplate.setChannelTransacted(true);
          return rabbitTemplate;
      }
  
  @Bean
      public TopicExchange testExchange() {
          final boolean durable = true;
          final boolean autoDelete = false;
          return new TopicExchange(EXCHANGE_NAME, durable, autoDelete);
      }
  </code></pre>
  
  <p>I am using spring-amqp 1.5.1.RELEASE.</p>
  
  <p>Any help is appreciated.</p>