Artemis JMS管理API

问题描述

我目前正在将Spring Boot 2.x应用程序从ActiveMQ 5.x迁移到Artemis,但是Artemis activemq.notificationsactivemq.management遇到了问题。

对于ActiveMQ 5,我使用了ActiveMQ.Advisory.Connection主题来查看当前是否已连接具有特定clientId的客户端。连接到该主题后,我首先收到了所有当前连接的客户端,然后收到ConnectionInfoRemovedInfo的通知,表明客户端是脱机还是联机。

很遗憾,阿尔emi弥斯不支持这种行为。收听activemq.notifications仅提供有关在主题上收听时创建的会话或关闭的会话的信息。

所以现在我需要在启动应用程序时同步连接的客户端。

我尝试使用JMS管理API访问ActiveMQServerControl.listConnectionIDs(),但是 org.apache.activemq.artemis.core.server.management.impl.ManagementServiceImpl.getAttribute()方法仅允许访问以getis开头的方法。

还有其他方法来获取所需的信息(无需轮询)吗?

解决方法

您可以执行操作而不是使用类似的方法获取属性

org.apache.activemq.artemis.api.jms.management.JMSManagementHelper.putOperationInvocation(m,ResourceNames.BROKER,"listConnectionIDs");

请注意,这可能不起作用,我只想向您展示一个例子。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...