[英]Connecting to TCP and consuming JMS topic
basically, i want to do a "tail -f" on a jms topic using tcp port. 基本上,我想使用tcp端口对jms主题执行“ tail -f”操作。 so instead of "tail -f ", it is more like "telnet server1 40000" to view the contents of the topic.
因此,代替“ tail -f”,它更像是“ telnet server1 40000”来查看主题的内容。
currently I am thinking about using netty.io, but not sure if spring-integration can handle it. 目前,我正在考虑使用netty.io,但不确定spring-integration是否可以处理它。
has anybody even done something like this? 有人做过这样的事情吗?
using a message listener would be great, except, i only want to consume the topic when a tcp connection is established. 使用消息监听器会很好,除了,我只想在建立TCP连接时使用该主题。
Thanks. 谢谢。
It's pretty easy to set up a service that responds to a TcpConnectionOpenEvent
by opening a consumer to the JMS topic and streaming the messages to the connection. 通过打开JMS主题的使用者并将消息流式传输到连接,设置响应
TcpConnectionOpenEvent
的服务非常容易。
You need inbound and outbound TCP adapters. 您需要入站和出站TCP适配器。
When the inbound adapter detects a new connection it emits the event. 当入站适配器检测到新连接时,它将发出事件。 Use an
ApplicationListener
(or even inbound adapter) to catch the event, capture the connection ID, open a consumer on the topic and start sending messages to the outbound adapter (set the ip_connectionId
so the adapter knows where to route the message). 使用
ApplicationListener
(或什至入站适配器)来捕获事件,捕获连接ID,在主题上打开使用者并开始将消息发送到出站适配器(设置ip_connectionId
以便适配器知道将消息路由到何处)。
When the client closes the connection, you'll get a connection closed event; 当客户端关闭连接时,您将收到一个连接关闭事件。 stop the topic consumer and unregister it.
停止主题使用者并取消注册。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.