Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
2.17.1
-
None
-
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)
-
Unknown
Description
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.
Attachments
Issue Links
- links to