-
Enhancement
-
Resolution: Duplicate
-
Major
-
jboss-fuse-6.2.1
-
None
-
%
-
-
6.3 Sprint 4 (Mar 28 - Apr 29)
I have a use case where I need to connect to a server via TCP. The protocol of the server expects a certain sequence of messages to initialize the communication channel. For example certain counters need to be synchronized before the first "real" message can be exchanged.
For example:
1. Camel sends synchronization request to Server
2. Server answers with a positive or negative response
3. Server sends a new message to Camel
4. Camel answers with a receipt
5. Message from Server will be transformed to a request of a 3rd service.
6. the response of the 3rd service is being transformed to the server format
7. response is being send to Server
8. Server replies with a receipt.
The whole communication with the Server has to happen through the same TCP connection. A new connection would require a new synchronization first.
Here is what camel route looks like:
<route startupOrder="10"> <from uri="timer://test?delay=2s&period=10000" /> <to pattern="InOut" uri="direct:service"/> <log message="From Direct -- ${body}"/> </route> <route startupOrder="1"> <from uri="direct:service"/> <process ref="setBodyProcessor"/> <log message="The first TCP call -- ${body}"/> <to uri="netty:tcp://remotehost:17080/test?encoders=#string-encoder&disconnect=false&sync=true&clientMode=true&synchronous=true" /> <log message="The second TCP call -- ${body}"/> <to uri="netty:tcp://remotehost:17080/test?encoders=#string-encoder&disconnect=false&sync=true&clientMode=true&synchronous=true" /> <log message="The third TCP call -- ${body}"/> <to uri="netty:tcp://remotehost:17080/test?encoders=#string-encoder&disconnect=false&sync=true&clientMode=true&synchronous=true" /> </route>
I had the same camel-netty producer endpoint to invoke out multiple times, since there are multiple messages which have to be exchanged back and forth over the same connection.
Unfortunately, there isn't a way to force those multiple camel-netty producer endpoints to share the same TCP connection. The camel-netty producer endpoint always creates a new connection even though it was the same endpoint uri used.
We need allow multiple camel-netty producer endpoints (with the same uri) to use the same existing connection.