title: Retry spring integration IntegrationFlow on exception
body: <p>I have a spring integration <code>IntegrationFlow</code> that's defined like this:</p>
  
  <pre><code>IntegrationFlows.from(Amqp.inboundAdapter(connectionFactory, "queueName")
                      .id("id")
                      .autoStartup(autoStartup)
                      .concurrentConsumers(2)
                      .maxConcurrentConsumers(3)
                      .messageConverter(messageConverter()))
                      .aggregate(a -&gt; ...)
                      .handle(serviceActivatorBean)
                      .get();
  </code></pre>
  
  <p>And <code>serviceActivatorBean</code> looks like this:</p>
  
  <pre><code>@Component
  @Transactional
  public class ServiceActivator {
  
      @ServiceActivator
  
      public void myMethod(Collection&lt;MyEvent&gt; events) {
          ....
      }    
  }
  </code></pre>
  
  <p>If <code>myMethod</code> throws an exception it will be logged but no retry will happen. I've tried to change the <code>IntegrationFlow</code> to this:</p>
  
  <pre><code>RequestHandlerRetryAdvice advice = new RequestHandlerRetryAdvice();
  RetryTemplate retryTemplate = new RetryTemplate();
  SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy();
  retryPolicy.setMaxAttempts(5);
  retryTemplate.setRetryPolicy(retryPolicy);
  advice.setRetryTemplate(retryTemplate);
  
  IntegrationFlows.from(Amqp.inboundAdapter(connectionFactory, "queueName")
                      .id("id")
                      .autoStartup(autoStartup)
                      .adviceChain(advice)
                      .concurrentConsumers(2)
                      .maxConcurrentConsumers(3)
                      .messageConverter(messageConverter()))
                      .aggregate(a -&gt; ...)
                      .handle(serviceActivatorBean)
                      .get();
  </code></pre>
  
  <p>But then I a log message like this (an retries won't happen):</p>
  
  <blockquote>
    <p>2017-06-30 13:18:10.611  WARN 88706 --- [erContainer#1-2]
    o.s.i.h.a.RequestHandlerRetryAdvice      : This advice
    org.springframework.integration.handler.advice.RequestHandlerRetryAdvice
    can only be used for MessageHandlers; an attempt to advise method
    'invokeListener' in
    'org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$1'
    is ignored</p>
  </blockquote>
  
  <p>How can I configure this <code>IntegrationFlow</code> to behave the same way a <code>RabbitListener</code> would? I.e. let RabbitMQ publish the messages again.</p>