作者:沈畅棉多多_574 | 来源:互联网 | 2023-10-12 18:34
1、TopicExchange2、案例3、通过配置类实现1、配置TopicConfig2、添加Listener3、测试结果4、通过注解实现1、配置Linstener2、测试结果
1、TopicExchange

2、案例

3、通过配置类实现
1、配置TopicConfig

2、添加Listener

3、测试结果

4、通过注解实现
1、配置Linstener

2、测试结果

5、总结分析

学到这里,关于RabbitMQ的五种消息模型就结束了。
1、第一种消息模型:单个队列,消息只能消费一次。
2、第二种消息模型:多个队列,消息只能消费一次。
3、第三种订阅模型:通过广播的形式推送消息,只要是绑定的队列,都能接收到推送的消息。
4、第四种订阅模型:通过路由的形式推送消息,同一个routingkey可以绑定一个队列,也可以绑定多个队列,推送的消息会去找与routingkey绑定的队列。
5、第五种订阅模型:通过主题的形式推送消息,这种方式支持 # 通配符,routingkey只需要部分匹配即可接收到推送的消息。
SpringAMQP TopicExchange 源码
https://download.csdn.net/download/weixin_40968009/87043682以上内容来自黑马程序员,课程学习节奏循序渐进。本人学习后觉得非常不错,有兴趣的小伙伴千万不要错过。
SpringCloud 黑马程序员公开课
https://www.bilibili.com/video/BV1LQ4y127n4/?spm_id_from=333.337.search-card.all.click&vd_source=14fddb9f4c113af7bdb1f50651dffc4d