CAMEL-10051 - Fixed issue with reuse channel.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/eed88d16 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/eed88d16 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/eed88d16 Branch: refs/heads/camel-2.17.x Commit: eed88d16f57f351a54c4832c68ecb9d1ece21428 Parents: df2a31a Author: grigoriadis <grigoria...@itsaur.com> Authored: Sun Jun 12 15:48:41 2016 +0300 Committer: Claus Ibsen <davscl...@apache.org> Committed: Sun Jun 12 16:31:54 2016 +0200 ---------------------------------------------------------------------- .../org/apache/camel/component/netty4/NettyProducer.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/eed88d16/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java ---------------------------------------------------------------------- diff --git a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java index c181ebf..4bdc121 100644 --- a/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java +++ b/components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyProducer.java @@ -278,7 +278,13 @@ public class NettyProducer extends DefaultAsyncProducer { // need to declare as final final Channel channel = existing; - final AsyncCallback producerCallback = new NettyProducerCallback(channel, callback); + final AsyncCallback producerCallback; + + if(configuration.isReuseChannel()) { + producerCallback = callback; + } else { + producerCallback = new NettyProducerCallback(channel, callback); + } // setup state as attachment on the channel, so we can access the state later when needed putState(channel, new NettyCamelState(producerCallback, exchange));