开发者

communicate with remote host using camel-netty tcp

I have a program running on a remote host that I need to connect to, handshake, then listen for messages. I have setup the following camel route:

<route>
   <from uri="netty:tcp://localhost:50001?decoders=#decoders&amp;sync=false" />
   <bean ref="TransformMessage" method="inboundDecoder" />
   <to uri="eventadmin:messages/aacus/inbound" />
</route>

<route>
   <from uri="eventadmin:messages/aacus/outbound" />
   <bean ref="TransformMessage" method="outboundEncoder" />
   <to uri="netty:tcp://192.168.0.111:50001?allowDefaultCodec=false&amp;sync=false" />
</route>

My question is how do I make this work? If I establish the route using

<from uri="netty:tcp://192.168.0.111:50001?decoders=#decoders&开发者_StackOverflow社区amp;sync=false" />

it fails with a binding error.

How can I setup the connection to respond on a specific port without modifying the server?


This is not possible with either camel-mina nor camel-netty at this time of writing. A consumer can only bind to a local server. There is a JIRA ticket at Apache to implement such a new feature for the future. https://issues.apache.org/jira/browse/CAMEL-1077


Use the following workaround:

Instead ob 192.168.0.111 use localhost. Then install "socat" and start it as follows

socat -s -u tcp4:192.168.0.111:50001 tcp4:localhost:50001

This will Tunnel your remote connection to the local service you created with camel/netty.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜