Invoke Management Operations using Core Messages
These steps can be simplified to make it easier to invoke management operations using Core messages: Create a ClientRequestor to send messages to the management address and receive replies Create a ClientMessage Use the helper class org.hornetq.api.core.management.ManagementHelper to fill the message with the management properties Send the message using the ClientRequestor Use the helper class org.hornetq.api.core.management.ManagementHelper to retrieve the operation result from the management reply For example, to find out the number of messages in the core queue exampleQueue: ClientSession session = ... ClientRequestor requestor = new ClientRequestor(session, "jms.queue.hornetq.management"); ClientMessage message = session.createMessage(false); ManagementHelper.putAttribute(message, "core.queue.exampleQueue", "messageCount"); ClientMessage reply = requestor.request(m); int count = (Integer) ManagementHelper.getResult(reply); System.out.println("There are " + count + " messages in exampleQueue"); Management operation name and parameters must conform to the Java interfaces defined in the management packages. Names of the resources are built using the helper class org.hornetq.api.core.management.ResourceNames and are straightforward (core.queue.exampleQueue for the Core Queue exampleQueue, jms.topic.exampleTopic for the JMS Topic exampleTopic, e