Skip to content

Instantly share code, notes, and snippets.

@lulf
Last active September 27, 2016 11:03
Show Gist options
  • Save lulf/f76bb8b6da0bf373be69d2e0990e462f to your computer and use it in GitHub Desktop.
Save lulf/f76bb8b6da0bf373be69d2e0990e462f to your computer and use it in GitHub Desktop.
this.locator = ActiveMQClient.createServerLocator(String.format("tcp://%s:%s", mgmtEndpoint.hostName(), mgmtEndpoint.port()));
this.sessionFactory = locator.createSessionFactory();
this.session = sessionFactory.createSession();
ClientRequestor requestor = new ClientRequestor(session, "jms.queue.activemq.management");
ClientMessage message = session.createMessage(false);
ManagementHelper.putOperationInvocation(message, address, "listAllSubscriptionsAsJSON");
session.start();
ClientMessage reply = requestor.request(message);
String retVal = (String)ManagementHelper.getResult(reply);
session.stop();
return retVal;
[{"queueName":"helloclient:helloclient","clientID":null,"selector":null,"name":"helloclient:helloclient","durable":true,"messageCount":0,"deliveringCount":0,"consumers":"[{\"consumerID\":0,\"connectionID\":\"1771513900\",\"sessionID\":\"1c67e2eb-84a1-11e6-8605-44850066eaf9\",\"browseOnly\":false,\"creationTime\":1474973818275}]"}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment