使用camel-netty tcp与远程主机通信
我有一个程序在远程主机上运行,我需要连接到它、握手,然后监听消息。我已经设置了以下骆驼路线:
<route>
<from uri="netty:tcp://localhost:50001?decoders=#decoders&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&sync=false" />
</route>
我的问题是如何使其工作? 建立路由
如果我使用
,则会因绑定而失败错误。
如何设置连接以在特定端口上响应而不修改服务器?
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&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&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&sync=false" />
it fails with a binding error.
How can I setup the connection to respond on a specific port without modifying the server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在撰写本文时,这对于camel-mina 和camel-netty 来说都是不可能的。消费者只能绑定到本地服务器。 Apache 有一个 JIRA 票证,可以在未来实现这样的新功能。 https://issues.apache.org/jira/browse/CAMEL-1077
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
使用以下解决方法:
使用
localhost
代替192.168.0.111
。然后安装“socat”并启动它,如下所示。
这会将您的远程连接隧道连接到您使用camel/netty创建的本地服务。
Use the following workaround:
Instead ob
192.168.0.111
uselocalhost
.Then install "socat" and start it as follows
This will Tunnel your remote connection to the local service you created with camel/netty.