activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Nodet <>
Subject Pure JMS management
Date Thu, 18 May 2017 22:23:07 GMT
I'm trying do perform management operation with pure JMS api.
To retrieve the list of queues, I'm currently using the following code:

QueueSession session = ((QueueConnection)
connection).createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
Queue managementQueue = session.createQueue("");
QueueRequestor requestor = new QueueRequestor(session, managementQueue);
TextMessage m = session.createTextMessage();
m.setStringProperty("_AMQ_ResourceName", "broker");
m.setStringProperty("_AMQ_OperationName", "getQueueNames");
m.setText("[\"" + routing + "\"]");
Message reply = requestor.request(m);
Class<?> mgmtHelperClass =
Method getResultsMethod = mgmtHelperClass.getMethod("getResults",
Object[] results = (Object[]) getResultsMethod.invoke(null, reply);
List<String> names = new ArrayList<>();
for (Object o : (Object[]) (results[0])) {
return names;

It works, but I think I should not have to use reflection to access the
result message, hence the use of reflection to access the
JMSManagementHelper methods.
It seems to me the reply should be of type TextMessage, but it's currently
untyped, so I can't use TextMessage#getText to retrieve the json result,
and I can't find a way to retrieve it another way.
Do I miss anything ?

Guillaume Nodet

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message