http://activemq.apache.org/advisory-message.html

ActiveMQ broker 内部维持了一些 topic,保存了一些系统信息,客户端可以订阅这些 topic 来获取信息,即 advisory message。

列举3个 topic 的例子:

1. topic名:ActiveMQ.Advisory.Connection

消息类型:客户端连接建立和断开的消息

获取方式:

AdvisorySupport.getConnectionAdvisoryTopic()

2. topic名:ActiveMQ.Advisory.Producer.Queue.XXX

消息类型:XXX队列当前有几个producer,以及producer删除的消息

获取方式:

AdvisorySupport.getProducerAdvisoryTopic(Destination destination)

3. topic名:ActiveMQ.Advisory.Queue,ActiveMQ.Advisory.Topic, ActiveMQ.Advisory.TempQueue, ActiveMQ.Advisory.TempTopic

消息类型:destination创建和销毁的消息

获取方式:

AdvisorySupport.getDestinationAdvisoryTopic(Destination destination)

示例代码:

public static void main(String[] args) throws JMSException {
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("tcp://localhost:61616");
// Create a Connection
Connection connection = connectionFactory.createConnection();
connection.start(); ActiveMQSession session = (ActiveMQSession) connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
// Create the destination (Topic or Queue)
Queue queue = session.createQueue("TEST.FOO");
// topic://ActiveMQ.Advisory.Producer.Queue.TEST.FOO
ActiveMQTopic topic = AdvisorySupport.getProducerAdvisoryTopic(queue); MessageConsumer consumer = session.createConsumer(topic);
consumer.setMessageListener(new MessageListener() {
public void onMessage(Message msg) {
if(msg instanceof ActiveMQMessage) {
System.out.println(msg);
}
}
}); }

ActiveMQ Advisory Message的更多相关文章

  1. ActiveMQ处理Message(String -javabean)

    一.ActiveMq想要实现必备的六要素(基于jms) //链接工厂.用于创建链接 private ConnectionFactory factory; //用于访问Mq的链接,由链接工厂创建 pri ...

  2. 分布式-信息方式-ActiveMQ的Message dispatch高级特性之(指针) Message cursors

    Message dispatch高级特性之 Message cursors概述            ActiveMQ发送持久消息的典型处现方式是:当消息的消费者准备就绪时,消息发送系统把存储的 消息 ...

  3. ActiveMQ学习笔记(17)----Message高级特性(一)

    1. Messaage Properties ActiveMQ支持很多消息属性,具体可以参考 http://activemq.apache.org/activemq-message-propertie ...

  4. ActiveMQ入门

    ActiveMQ简介 概要 开源 JMS-compliant 消息中间件message-oriented middleware(MOM) 松耦合,相对于RPC的紧耦合 发送消息fire-and-for ...

  5. MQ学习(二)----ActiveMQ简介(转)

    1.  什么是ActiveMQ ActiveMQ是一种开源的,实现了JMS1.1规范的,面向消息(MOM)的中间件,为应用程序提供高效的.可扩展的.稳定的和安全的企业级消息通信.ActiveMQ使用A ...

  6. ActiveMQ in Action(1) - JMS

    关键字: activemq 1 JMS    在介绍ActiveMQ之前,首先简要介绍一下JMS规范.1.1 JMS的基本构件1.1.1 连接工厂    连接工厂是客户用来创建连接的对象,例如Acti ...

  7. ActiveMQ笔记——技术点汇总

    目录 · Introduction to ActiveMQ · Installing ActiveMQ · Message-oriented middleware · JMS specificatio ...

  8. Message高级特性 & 内嵌Jetty实现文件服务器

    1. Messaage Properties  常见属性 更多的属性以及介绍参考:http://activemq.apache.org/activemq-message-properties.html ...

  9. ACTIVEMQ主题、队列设置用户名密码

    修改文件%ACTIVEMQ_BASE%/conf/activemq.xml,用户名密码储存在文件%ACTIVEMQ_BASE%/conf/credentials.properties中, active ...

随机推荐

  1. 树莓派 无屏幕 安装Ubuntu系统 无头安装 无显示器 用网线

    能看到此篇博客的人说明都尝试失败了,会发现内存卡刷入Ubuntu后,无法通过ssh操作树莓派.是因为官方的ubuntu系统在初次运行时需要设定一些东西,类似windows第一次启动也需要设置那样,如果 ...

  2. hdu 5724 Chess 博弈sg+状态压缩

    Chess Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem De ...

  3. CAP原则

    CAP原则又称CAP定理,指的是在一个分布式系统中,Consistency(一致性). Availability(可用性).Partition tolerance(分区容错性),三者不可兼得 分布式系 ...

  4. sort-插入排序

    void sort_insertion(vector<int> &v) { for(int i=1;i<v.size();i++) { for(int j=i;j>0; ...

  5. opencv4.0 cuda10 编译速度太慢

    opencv4.0 cuda10 对比不带cuda的时候,编译速度太慢,主要卡在cuda的编译上. 参考http://answers.opencv.org/question/5090/why-open ...

  6. R语言画点状误差线

    现在项目需要R语言做几个线性拟合,画一些点图,突然需要画误差线,网上找了下,可以用代码实现..效果如下 xx1<-c(xxxxxx,xxxx,xxxxx) yy1<-c(xxxxxx,xx ...

  7. Backup and Recovery Types

    Physical(Raw) and Logical Backup: 1.Physical backups consist of raw copies of the directories and fi ...

  8. pythoncook 文件和io

    1.文件不存在,则写入:文件存在则,报错 try: with open('file','x') as f: f.write() except FileExistsError: print('file ...

  9. synchronized相关用法简述

    synchronized 锁,他是一个java 的关键字,能够保证同一线程只有一个线程访问或使用此修饰的代码块 用法 synchronized方法,synchronized块 synchronized ...

  10. Confluence 6 创建一个项目空间

    火星移民小组的程序需要一个地方能够调出他们任务的相关关键信息和资源,你的任务就是帮助他们实现和管理这个需求.这部分是比较容易实现的,因为这些信息需要让空间项目组中完全可见. 这样的话,你就可以设置项目 ...