Error messages never delivered to error channel after upgrade to 1.1.3 spring integration java dsl
<p>I have used spring integration in our application. Recently we have tried upgrading our project to <code>spring boot 1.4 release</code>, which uses <code>spring java dsl 1.1.3</code>. In the latest release they have deprecated <code>messageDriverChannelAdapter</code> and created a new method with name <code>messageDriverChannelAdapter</code>, i.e 'r' fixed.</p>

<p>Integration flow works fine when using <code>messageDriverChannelAdapter</code> of java dsl 1.1.1 but it fails in 1.1.3 in a failure case(i.e Exception occur in a flow).</p>

<p>Here is my flow</p>

<pre><code>IntegrationFlows
                .from(Jms.messageDriverChannelAdapter(listenerContainer()).errorChannel(errorChannel())
                        .outputChannel(listenerDirectChannel()))
                .channel(listenerDirectChannel()).transform(new JsonToChangeObjectTransformer())
                .channel(conversionOutChannel()).handle(CHANGED_OBJECT_LISTENER_IMPL, PROCESS_MESSAGE)
                .channel(errorChannel()).handle(FAILED_MESSAGE_HANDLER_IMPL, HANDLE_ERROR).get();
</code></pre>

<p>I have even tried routing </p>

<pre><code>IntegrationFlows
                .from(Jms.messageDrivenChannelAdapter(listenerContainer())
                       .errorChannel(errorChannel())
                       .outputChannel(listenerDirectChannel()))
                       .channel(listenerDirectChannel())
                       .transform(new JsonToChangeObjectTransformer())
                       .&lt;Object, Boolean&gt; route(p -&gt; p instanceof ChangedObject,
                        m -&gt; m.channelMapping("true", "conversionOutChannel").channelMapping("false", "errorChannel"))
                         .channel(conversionOutChannel())
                       .handle(CHANGED_OBJECT_LISTENER_IMPL, PROCESS_MESSAGE).channel(errorChannel())
                       .handle(FAILED_MESSAGE_HANDLER_IMPL, HANDLE_ERROR).get();
</code></pre>

<p>but Still no luck </p>

<p>My observation is message never delivered to error channel(as I have debugged) and it keeps on trying to place message in channel which ultimately causes <code>stackoverflowerror</code></p>

<p><strong>Exception:</strong> </p>

<pre><code>org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:212)
    at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:129)
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:160)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121)
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
    at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:105)
    at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:292)
    at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:212)
    at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:129)
    at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:115)
    at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:127)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:160)
    at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:121)
    at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:77)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:423)
    at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:373)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:115)
    at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:45)
</code></pre>