You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by souciance <so...@gmail.com> on 2016/05/10 12:28:19 UTC

Camel netty tcp new instance for each client connection

Hello,

I have a scenario where in a Camel route I have a from ("netty4:tcp") which
listens on a ip:port. Clients can connect to it and send string messages.
The first message each client sends identifies who they are. Subsequent
messages are normal payload. However the backend system needs the identifier
each time.

My question is, how is it possible to identify when a client connections to
the route and have a "seperate pipeline" or session for that particular
client sending messages, and a new pipeline or session when another client
starts connection? Is this possible?

Thanks
Best
Souciance



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-netty-tcp-new-instance-for-each-client-connection-tp5782404.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel netty tcp new instance for each client connection

Posted by Quinn Stevenson <qu...@pronoia-solutions.com>.
I haven’t tried this myself, but I think you could get the Netty Channel from the exchange property CamelNettyChannel, and use and attribute on the channel to store your information.

Another option may be to use a map to store some state, and use the CamelNettyRemoteAddress header as the key for your information.  You’d have to figure out when to invalidate the information in the map though (i.e. timeout, some close message, etc)

> On May 10, 2016, at 6:28 AM, souciance <so...@gmail.com> wrote:
> 
> Hello,
> 
> I have a scenario where in a Camel route I have a from ("netty4:tcp") which
> listens on a ip:port. Clients can connect to it and send string messages.
> The first message each client sends identifies who they are. Subsequent
> messages are normal payload. However the backend system needs the identifier
> each time.
> 
> My question is, how is it possible to identify when a client connections to
> the route and have a "seperate pipeline" or session for that particular
> client sending messages, and a new pipeline or session when another client
> starts connection? Is this possible?
> 
> Thanks
> Best
> Souciance
> 
> 
> 
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-netty-tcp-new-instance-for-each-client-connection-tp5782404.html
> Sent from the Camel - Users mailing list archive at Nabble.com.