14.2 使用advisory监控ActiveMQ

博客已搬家, 更好阅读体验, 猛戳 http://www.jack-yin.com/coding/translation/activemq-in-action/1873.html

14.2 Monitoring ActiveMQ with advisory messages

14.2 使用advisory监控ActiveMQ

The JMX API is  a well-known mechanism often  used to manage and  monitor a wide

range of Java applications. But since you’re already building a JMS application

using ActiveMQ, shouldn’t it be natural to receive messages regarding important

broker events using  the same JMS  API? Fortunately, ActiveMQ  provides what are

known as advisory messages to represent administrative commands that can be used

to notify messaging clients about important broker events.

JMX API是一个众所周知的机制经常被用来管理和监控大量的Java应用程序.但是,既然已经使用

ActiveMQ创建了一个JMS应用程序,同样使用JMS API来接收有关代理事件的相关消息就理所当然了.

幸运的是,ActiveMQ提供了被称为advisory的消息来表示管理命令可用来通知消息客户端有关代理

的重要事件信息.

14.2.1 Configuring advisory support

14.2.1 支持advisory消息的配置

Advisory  messages  are  delivered  to   topics  whose  names  use  the   prefix

ActiveMQ.Advisory.  For   example,  if   you’re  interested   in  knowing  when

connections to the broker are started and stopped, you can see this activity  by

subscribing to  the ActiveMQ.Advisory.Connection  topic. A  variety of  advisory

topics are available depending on what broker events interest you. Basic  events

such  as starting  and stopping  consumers, producers,  and connections  trigger

advisory  messages by  default. But  for more  complex events,  such as  sending

messages  to  a  destination  without  a  consumer,  advisory  messages  must be

explicitly enabled as shown next.

Advisory消息是发送到名称以ActiveMQ.Advisory开头的主题的消息.例如,如果你对连接何时

连接到代理或何时从代理断开感兴趣,你就可以订阅ActiveMQ.Advisory.Connection主题.不同

的代理事件有不同的advisory消息主题.基本事件,诸如启动和停止消费者,生产者以及连接都会

触发默认的advisory消息.但是对于更复杂的时间,例如发送消息给一个没有消费者的目的地,

advisory消息必须显式的开启,如下面代码所示:

...........................................

博客已搬家, 更好阅读体验, 猛戳 http://www.jack-yin.com/coding/translation/activemq-in-action/1873.html

猜你喜欢

转载自jackyin5918.iteye.com/blog/2002181
今日推荐