You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Grigoris Grigoriadis (JIRA)" <ji...@apache.org> on 2016/06/12 12:47:20 UTC

[jira] [Created] (CAMEL-10051) netty4 reuseChannel not working as expected

Grigoris Grigoriadis created CAMEL-10051:
--------------------------------------------

             Summary: 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:
from("direct:command1")
    .setBody(constant("PRE1"))
    .to(nettyEndpoint)
    .setBody(constant("PRE2"))
    .to(nettyEndpoint)
    .setBody(constant("COMMAND1"))
    .to(nettyEndpoint);
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)