[
https://issues.apache.org/jira/browse/CAMEL-10051?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15326425#comment-15326425
]
ASF GitHub Bot commented on CAMEL-10051:
----------------------------------------
GitHub user grigoriadis opened a pull request:
https://github.com/apache/camel/pull/1026
CAMEL-10051 - Fixed issue with reuse channel.
When reuseChannel is set to true, channel is not returned to the pool every
time a message is sent
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/grigoriadis/camel CAMEL-10051
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/camel/pull/1026.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1026
----
commit 5c4672b4e38cb88b5ffda8b1092ef759cec1b4e8
Author: grigoriadis <[email protected]>
Date: 2016-06-12T12:48:41Z
CAMEL-10051 - Fixed issue with reuse channel.
----
> netty4 reuseChannel not working as expected
> -------------------------------------------
>
> Key: CAMEL-10051
> URL: https://issues.apache.org/jira/browse/CAMEL-10051
> Project: Camel
> Issue Type: Bug
> Components: camel-netty4
> Affects Versions: 2.17.1
> Environment: Linux 4.6.1-1-default (OpenSuse Tumbleweed)
> openjdk version "1.8.0_77"
> OpenJDK Runtime Environment (build 1.8.0_77-b03)
> OpenJDK 64-Bit Server VM (build 25.77-b03, mixed mode)
> Reporter: Grigoris Grigoriadis
> Priority: Minor
>
> NettyProducer returns the channel to the pool every time a message is sent
> when the reuseChannel is set to true. It should instead return the channel to
> the pool only if the exchange is completed, so that other exchanges will not
> use the same channel.
> I have the following problem:
> I need to send messages to a legacy tcp server through a REST server.
> The tcp server requires messages from one connection to be send in a specific
> order, for example in order to send COMMAND1 I have to first send PRE1 and
> PRE2 and then COMMAND1. The component is set to reuseChannel=true and be
> sync=true and i have the following exchange:
> {code}
> from("direct:command1")
> .setBody(constant("PRE1"))
> .to(nettyEndpoint)
> .setBody(constant("PRE2"))
> .to(nettyEndpoint)
> .setBody(constant("COMMAND1"))
> .to(nettyEndpoint);
> {code}
> The problem is that the NettyProducer returns the channel to the pool every
> time i send a message. So if concurrent requests are sent to the REST server
> things get messy.
> NettyProducer supports this behavior, if the reuseChannel is set to true the
> producer adds an onCompletion listener on the exchange that returns the
> channel to the pool. The problem is that it also sets the callback of the
> NettyCamelState to a NettyProducerCallback which runs every time a message is
> send by the ClientChannelHandler and returns the channel to the pool.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)