Grokbase Groups Camel users June 2016

Thanks for reporting. Can you log a JIRA and attach your patch or do a github PR
On Sun, Jun 12, 2016 at 10:54 AM, grigoriadis wrote:

I'm using netty4 component (version 2.17.1) 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:
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.
I have debugged the NettyProducer code and i can see that there is support
for 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. I have fixed this
issue by creating a custom version of the NettyProducer:

diff --git
index a6bce2d..26d6acb 100644
@@ -282,7 +282,11 @@ public class NettyProducer extends DefaultAsyncProducer

// need to declare as final
final Channel channel = existing;
- final AsyncCallback producerCallback = new
NettyProducerCallback(channel, callback);
+ if (configuration.isReuseChannel()) {
+ producerCallback = callback;
+ } else {
+ producerCallback = new NettyProducerCallback(channel,
+ }

// setup state as attachment on the channel, so we can access the
state later when needed
putState(channel, new NettyCamelState(producerCallback, exchange));


Claus Ibsen
----------------- @davsclaus
Camel in Action 2:

Search Discussions

Discussion Posts


Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 2 | next ›
Discussion Overview
groupusers @
postedJun 12, '16 at 8:54a
activeJun 12, '16 at 9:14a

2 users in discussion

Claus Ibsen: 1 post Grigoriadis: 1 post



site design / logo © 2018 Grokbase