@Tim Bain: yes.. Artemis from what I see on the class Names (I also
spoke to him gnodet on the IRC channel earlier today).

@gnodet: I am not understanding why you would need to use reflection.
You can just simply use JMSManagementHelper directly. they are all
static methods...


This example here, part of distribution under
examples/features/standard/management shows how it was intended to be
used:


https://github.com/apache/activemq-artemis/blob/master/examples/features/standard/management/src/main/java/org/apache/activemq/artemis/jms/example/ManagementExample.java



Maybe I"m misunderstanding your question?

On Thu, May 18, 2017 at 6:23 PM, Guillaume Nodet <gno...@apache.org> wrote:
> 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("activemq.management");
> QueueRequestor requestor = new QueueRequestor(session, managementQueue);
> connection.start();
> TextMessage m = session.createTextMessage();
> m.setStringProperty("_AMQ_ResourceName", "broker");
> m.setStringProperty("_AMQ_OperationName", "getQueueNames");
> m.setText("[\"" + routing + "\"]");
> Message reply = requestor.request(m);
> Class<?> mgmtHelperClass =
> connection.getClass().getClassLoader().loadClass("org.apache.activemq.artemis.api.jms.management.JMSManagementHelper");
> Method getResultsMethod = mgmtHelperClass.getMethod("getResults",
> Message.class);
> Object[] results = (Object[]) getResultsMethod.invoke(null, reply);
> List<String> names = new ArrayList<>();
> for (Object o : (Object[]) (results[0])) {
>     names.add(o.toString());
> }
> 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



-- 
Clebert Suconic

Reply via email to