Use the "getQueueNames" method on the address control [1], e.g.: try (ServerLocator locator = ActiveMQClient.createServerLocator("vm://0"); ClientSessionFactory factory = locator.createSessionFactory(); ClientSession session = factory.createSession(false, true, true)) {
ClientRequestor requestor = new ClientRequestor(session, "activemq.management"); ClientMessage message = session.createMessage(true); ManagementHelper.putOperationInvocation(message, String.format("%s%s", ResourceNames.ADDRESS, "myAddress"), "getQueueNames"); session.start(); ClientMessage reply = requestor.request(message); requestor.close(); for (Object results : ManagementHelper.getResults(reply)) { for (Object result : ((Object[])results)) System.out.println(result); } } Justin [1] https://activemq.apache.org/components/artemis/documentation/javadocs/javadoc-latest/org/apache/activemq/artemis/api/core/management/AddressControl.html#getQueueNames() On Tue, Oct 25, 2022 at 3:26 PM Thai Le <lnthai2...@gmail.com> wrote: > Hello, > I am using ActiveMQClient to talk to the artemis broker. I am trying to > move all the messages in a topic to another topic programmatically. The > only pieces of info I have is the broker URL, username, password and the > topic name (the address). However, since there are quite a number of > subscribers to this topic, I want to get the list of queues associated with > the address and run the move operation on each of them. Unfortunately, i do > not see any operation that return the list of queues associated with the > address (topic). Here is my current code: > > > try (ServerLocator locator = > ActiveMQClient.createServerLocator(broker.getUrl()); > ClientSessionFactory factory = locator.createSessionFactory(); > ClientSession session = factory.createSession(broker.getAdmin(), > broker.getAdminPassword(), false, true, true, true, 10);) { > > > > ClientRequestor requestor = new ClientRequestor(session, > "activemq.management"); ClientMessage message = > session.createMessage(true); ManagementHelper.putOperationInvocation( > > message > > , String.format("%s%s", ResourceNames.ADDRESS, oldTopicAddress) > > , "?????"); session.start(); ClientMessage reply = > requestor.request(message); requestor.close(); return > extractQueueNames(reply); > > > > Hope to get some hint > > Thai Le >