如何检测 JMS 主题连接丢失 [英] How to detect loss of JMS Topic connection

查看:34
本文介绍了如何检测 JMS 主题连接丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有连接到服务器进程的摆动 GUI 客户端.

We have swing GUI clients that are connecting to a server process.

客户端使用 jms:queue 'from' 在 Camel 路由中定义的端点'调用'服务器上的服务,并使用 ActiveMQ 作为底层 JMS 代理.

The clients 'call' services on the server using jms:queue 'from' endpoints defined in Camel routes, and using ActiveMQ as the underlying JMS broker.

但是,客户端还提供了一个 Camel jms:topic 端点,供服务器将消息广播回客户端.

However, the client also offers a Camel jms:topic endpoint for the server to broadcast messages back to the client.

不幸的是,主题连接似乎以某种方式丢失了,尽管客户端仍然可以调用"服务器上的服务,但服务器无法向客户端的主题端点发送任何消息.

Unfortunately, it looks like the topic connection is getting lost somehow, and although the client can still 'call' the services on the server, the server cannot send any messages to the client's topic endpoint.

Camel 端点的客户端 spring 定义如下:

The client-side spring definition of the Camel endpoint is as follows:

    <camel:route>
        <camel:from uri="jms:topic:inUseQueue"/>
        <camel:to uri="bean:inUseInterfaceImpl"/>
    </camel:route>

而服务端生产者定义如下:

And the server-side producer is defined as follows:

<bean id="inUseManagerImpl" class="org.apache.camel.spring.remoting.CamelProxyFactoryBean">
  <property name="serviceUrl" value="jms:topic:inUseQueue"/>
  <property name="serviceInterface" value="uniworks.core.inuse.InUseInterface"/>
</bean>

有谁知道我们可以通过某种方式在客户端检测此主题连接丢失的方法吗?

Does anyone know of a way that we can somehow detect the loss of this topic connection on the client side?

推荐答案

我意识到这是一个 8 个月前的问题,但是这到底是怎么回事.

I realize this is a 8 month old question, but hey what the hell.

让服务器每分钟广播一次isalive"消息是否有意义,这样如果客户端没有收到任何isalive"消息,它可以假定它已断开连接.

would it make sense to make the server broadcast "isalive" message once a minute, this way if the client doesn't get any of the "isalive" messages it can presume it has been disconnected.

这篇关于如何检测 JMS 主题连接丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆