Reputation: 16301
My ActiveMQ messaging instance (ActiveMQ 5.16.2 on Amazon MQ) uses STOMP. I cannot use 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.
Assuming the broker cannot be changed, I was looking at the REST API mapping of JMS here, but I do not see any endpoint that mimic the ActiveMQ admin pages (JSP), that is capable to browse the queue, consumers and message content without actively "pulling" those messages from the queue.
So, how to implement that JMS logic we can see in the ActiveMQ admin pages programmatically (e.g. via REST apis)?
Looking at the docs of REST API, assumed having the logon, this approach works
curl -XGET https://user:pass@server:8162/admin/browse.jsp?JMSDestination=ActiveMQ.DLQ
and it grab the JSP page output as on the web console, so I assume that it could be done via some "official" rest API.
NOTE. The ActiveMQ JSP page is not using any AJAX call, so I assume it is using the JMS Java API directly.
Upvotes: 2
Views: 627
Reputation: 35123
The REST/JMS mapping doesn't offer any message browsing functionality.
However, it's worth noting that the REST/JMS mapping is independent of the management functionality exposed by Jolokia. Jolokia is an HTTP-JMX bridge so anything exposed via JMX can be accessed via HTTP (e.g. using curl
). The DestinationViewMBean
has various "browse" methods you can use, e.g.:
$ 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\(\)
Where TEST
is the name of your queue.
You can get a list of JMX objects using the search
command, e.g.:
$ curl -XGET -u admin:admin -H "Origin: http://localhost" http://localhost:8161/api/jolokia/search/org.apache.activemq:*
You can read more about the Jolokia Protocol on their website.
Upvotes: 2