basically, i want to do a "tail -f" on a jms topic using tcp port. so instead of "tail -f ", it is more like "telnet server1 40000" to view the contents of the topic.
currently I am thinking about using netty.io, but not sure if spring-integration can handle it.
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.
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.
You need inbound and outbound TCP adapters.
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).
When the client closes the connection, you'll get a connection closed event; stop the topic consumer and unregister it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.