Search code examples
javaspringapache-camelnettyjbossfuse

Camel Client for netty tcp port using


i am trying consume data from the server using port 7000. For which i have written the following camel endpoint.

from("netty:tcp://localhost:7000?sync=true&allowDefaultCodec=false&"
        +"encoder=#stringEncoder&decoder=#stringDecoder").to("bean:echoService");

But this is not working. I keep getting bind exception. what i understood is that the above route trying to host server on port 7000.I need to write a client to consume data from 7000. Please provide me reference to write the client to consume data from a port using camel netty end point.


Solution

  • I'm not totally clear on what you're asking. But if you're using Camel 2.15 or greater the option of clientMode, found in small print here, may be of use to you.

    It'll prevent the pesky bind exception.

    Also from what I understand, plain old netty is deprecated and you should be using netty4.

    So your route should look something like:

    from("netty4:tcp://localhost:7000?sync=true&allowDefaultCodec=false&"
        +"encoder=#stringEncoder&decoder=#stringDecoder&clientMode=true").to("bean:echoService");