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:
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.