STOMP over ActiveMQ 的 JMS 队列浏览器的替代方案?

Alternatives to JMS Queue Browser for STOMP over ActiveMQ?

我的 ActiveMQ 消息传递实例(Amazon MQ) uses STOMP. I the JMS QueueBrowser, and there is no way to "unack" a message. As soon as there is a consumer that pulled that message from the queue i.e. marked as "unconsumed" as stated in the docs here 上的 ActiveMQ 5.16.2。

假设无法更改代理,我正在查看 JMS here 的 REST API 映射,但我没有看到任何模仿 ActiveMQ 管理页面的端点(JSP),它能够浏览队列、消费者和消息内容,而无需主动从队列中“拉取”那些消息。

那么,如何以编程方式(例如通过 REST api)实现我们在 ActiveMQ 管理页面中看到的 JMS 逻辑?

查看 REST 文档 API,假设已经登录,此方法有效

curl -XGET https://user:pass@server:8162/admin/browse.jsp?JMSDestination=ActiveMQ.DLQ

它会像在 Web 控制台上一样获取 JSP 页面输出,所以我认为它可以通过一些“官方”休息来完成 API。

注意。 ActiveMQ JSP 页面没有使用任何 AJAX 调用,所以我假设它直接使用 JMS Java API。

REST/JMS mapping 不提供任何消息浏览功能。

但是,值得注意的是 REST/JMS 映射独立于 Jolokia 公开的管理功能。 Jolokia 是一个 HTTP-JMX 桥,因此可以通过 HTTP 访问通过 JMX 公开的任何内容(例如使用 curl)。 DestinationViewMBean 有多种您可以使用的“浏览”方法,例如:

$ curl -XGET -u admin:admin -H "Origin: http://localhost" http://localhost:8161/api/jolokia/exec/org.apache.activemq:type=Broker,brokerName=localhost,destinationType=Queue,destinationName=TEST/browse\(\)

其中 TEST 是队列的名称。

您可以使用 search 命令获取 JMX 对象列表,例如:

$ curl -XGET -u admin:admin -H "Origin: http://localhost" http://localhost:8161/api/jolokia/search/org.apache.activemq:*

您可以阅读有关 Jolokia Protocol on their website 的更多信息。