此内容没有您所选择的语言版本。

28.4. Using Management Via JMS


Using JMS messages to manage HornetQ is very similar to using core API.
An important difference is that JMS requires a JMS queue to send the messages to (instead of an address for the core API).
The management queue is a special queue and needs to be instantiated directly by the client:
   Queue managementQueue = HornetQJMSClient.createQueue("hornetq.management");
Copy to Clipboard Toggle word wrap
All the other steps are the same as for the Core API but they use JMS API instead:
  1. Create a QueueRequestor to send messages to the management address and receive replies.
  2. Create a Message.
  3. Use the helper class org.hornetq.api.jms.management.JMSManagementHelper to fill the message with the management properties.
  4. Send the message using the QueueRequestor.
  5. Use the helper class org.hornetq.api.jms.management.JMSManagementHelper to retrieve the operation result from the management reply.
For example, to know the number of messages in the JMS queue exampleQueue:
   Queue managementQueue = HornetQJMSClient.createQueue("hornetq.management");   
   
   QueueSession session = ...      
   QueueRequestor requestor = new QueueRequestor(session, managementQueue);
   connection.start();
   Message message = session.createMessage();
   JMSManagementHelper.putAttribute(message, "jms.queue.exampleQueue", "messageCount");
   Message reply = requestor.request(message);
   int count = (Integer)JMSManagementHelper.getResult(reply);
   System.out.println("There are " + count + " messages in exampleQueue");
Copy to Clipboard Toggle word wrap

28.4.1. Configuring JMS Management

Whether JMS or the core API is used for management, the configuration steps are the same (see Section 28.3.1, “Configuring Core Management”).
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat