添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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.

I'm not clear what you are trying to do.Are you listening on port 7000 for connections from a client, or are you trying to connect to a service that is listening on port 7000? – JimNicholson Dec 1, 2016 at 14:14

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");
                Thanks much for your response. I am trying to listen on port 7000. A process/server running on port 7000. i am trying to consume the data produced by port 7000. Basically client to receive data from 7000. I read about the clientMode=true.I think i tried with old version of camel .I will try with 2.15 along with netty4.
– user1668653
                Dec 1, 2016 at 15:05
                its working with below entry.from("netty:tcp://localhost:7000?sync=true&allowDefaultCodec=false&" 			    +"encoder=#stringEncoder&decoder=#stringDecoder&clientMode=true").to("bean:echoService");
– user1668653
                Dec 1, 2016 at 15:19
                Glad to hear it's working! I'd still suggest using netty4 instead of netty due to the fact netty is deprecated though!
– Jsmith
                Dec 1, 2016 at 15:29
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.