Did you try modifying your code as I recommended?  If so, what was the result?

I modified the "management" example locally as a proof-of-concept and it worked 
fine.  Here's the code (comments redacted):

         QueueSession session = connection.createQueueSession(false, 
Session.AUTO_ACKNOWLEDGE);
         Queue managementQueue = 
ActiveMQJMSClient.createQueue("activemq.management");
         QueueRequestor requestor = new QueueRequestor(session, 
managementQueue);
         connection.start();
         Message m = session.createMessage();
         JMSManagementHelper.putAttribute(m, ResourceNames.BROKER, 
"queueNames");  
         Message reply = requestor.request(m);
         Object[] queueNames = (Object[]) JMSManagementHelper.getResult(reply);
         for (Object queueName : queueNames) {
            System.out.println("Queue name: " + queueName);
         }

To be clear, 
org.apache.activemq.artemis.api.core.management.ResourceNames.BROKER 
essentially links to 
org.apache.activemq.artemis.api.core.management.ActiveMQServerControl.  Among 
others, it has methods getQueueNames() and getAddressNames() which should 
suffice for your purposes.  The idea of a JMS "server" and even a JMS topic was 
always a thin facade on top of the core implementation.  From a management and 
configuration perspective this facade has been removed to allow cleaner support 
for additional protocols (e.g. AMQP, MQTT, STOMP, etc.).

Hope that helps.


Justin

----- Original Message -----
From: "titou10 titou10" <[email protected]>
To: [email protected]
Sent: Wednesday, March 22, 2017 2:35:43 PM
Subject: Re: Artemis 2.0: How to get the list of Queues and Topics from a 
server? (Fails in 2.0 with v1.5.3 code)

Thanks for your answer

>> how to retrieve the list of Queues and Topics from an Artemis v2.0.0 server?
>
> I think you'll be good to just use 
> org.apache.activemq.artemis.api.core.management.ResourceNames.BROKER rather 
> than JMS_SERVER with your existing code.

It will not work...
Given the v1.5.x doc, JMS_SERVER (="jms.server") is linked to the
"org.apache.activemq.artemis.api.jms.management.JMSServerControl"
control class. This class has amongst many other methods, 2 methods
named "getQueueNames()" and "getTopicNames()"
This class has been removed from v2.0.0
I wasn't able to find to what control class the BROKER (="broker")
value is associated to in v2.0.0...

I was not able to find also if the methods from the JMSServerControl
that has been removed are available somewhere else in v2.0.x

So the question is still there, how to retrieve the list of topics and
queues from a v2.0.x Artemis server from a client?

Thanks

Denis (Author of JMSToolBox on sourceforge)

Reply via email to