RabbitMQ Exchange 模式 - topic
来源:互联网 发布:淘宝设计团队多少人 编辑:程序博客网 时间:2024/05/21 13:57
windows 下 安装 RabbitMQ 服务器 环境
RabbitMQ Exchange 模式 - direct
RabbitMQ Exchange 模式 - fanout
RabbitMQ Exchange 模式 - topic
任何发送到Topic Exchange的消息都会被转发到所有关心RouteKey中指定话题的Queue上
1. 这种模式需要RouteKey,要提前绑定Exchange与Queue。
2. 如果Exchange没有发现能够与RouteKey匹配的Queue,则会抛弃此消息。
3. 在进行绑定时,要提供一个该队列关心的主题,如“#.log.#”表示该队列关心所有涉及log的消息(一个RouteKey为”MQ.log.error”的消息会被转发到该队列)。
4. “#”表示0个或若干个关键字,“*”表示一个关键字。如“log.*”能与“log.warn”匹配,无法与“log.warn.timeout”匹配;但是“log.#”能与上述两者匹配。
参考代码:
执行代码:
执行结果:
如果 queue、exchange、routingKey 已经进行过绑定,则第二次执行代码时只需要用到 exchange 和 routingKey
注释掉队列后查看执行结果(2条消息):
查看绑定信息:
测试代码,点击下载
0 0
- RabbitMQ Exchange 模式 - topic
- RabbitMQ Exchange模式之Topic
- rabbitmq(五)topic exchange
- RabbitMQ的Exchange 模式之topic(主题模式)
- RabbitMQ三种Exchange模式(fanout,direct,topic)介绍
- RabbitMQ三种Exchange模式(fanout,direct,topic)
- RabbitMQ三种Exchange模式(fanout,direct,topic)
- 【RabbitMQ】——三种Exchange模式(Fanout、Direct、Topic)
- spring-boot | rabbitMq-Topic Exchange
- rabbitmq 交换模式-Topic
- rabbitmq 交换模式-Topic
- RabbitMQ三种Exchange模式(fanout,direct,topic)的性能比较
- RabbitMQ三种Exchange模式(fanout,direct,topic)的性能比较
- RabbitMQ三种Exchange模式(fanout,direct,topic)的性能比较
- RabbitMQ三种Exchange模式(fanout,direct,topic)的性能比较
- RabbitMQ Exchange 模式 - direct
- RabbitMQ Exchange 模式 - fanout
- RabbitMQ四种Exchange类型之Topic (Java)
- android 更改api版本
- 单一职责原则
- tomcat调优
- HTML5表单属性
- Contains Duplicate II
- RabbitMQ Exchange 模式 - topic
- js异步加载的三种方案
- iOS开发Xcode6及以上版本中使用PDF格式矢量图标资源
- C++ 重载==,使用栈的非递归算法
- PHP中获取类、方法、属性
- 链表 LinkedList 问题的总结
- 【杭电oj】2099 - 整除的尾数(枚举)
- POJ3253 Fence Repair 贪心法 哈夫曼树
- Xcode常用快捷键