首页>代码>springboot+rabbitmq整合简单消息队列示例>/mq-demo/consumer/src/main/java/com/liangzi/mq/config/FanoutConfig.java
package com.liangzi.mq.config; import org.springframework.amqp.core.Binding; import org.springframework.amqp.core.BindingBuilder; import org.springframework.amqp.core.FanoutExchange; import org.springframework.amqp.core.Queue; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class FanoutConfig { // itcast.fanout @Bean public FanoutExchange fanoutExchange(){ return new FanoutExchange("itcast.fanout"); } // fanout.queue1 @Bean public Queue fanoutQueue1(){ return new Queue("fanout.queue1"); } // 绑定队列1到交换机 @Bean public Binding fanoutBinding1(Queue fanoutQueue1, FanoutExchange fanoutExchange){ return BindingBuilder .bind(fanoutQueue1) .to(fanoutExchange); } // fanout.queue2 @Bean public Queue fanoutQueue2(){ return new Queue("fanout.queue2"); } // 绑定队列2到交换机 @Bean public Binding fanoutBinding2(Queue fanoutQueue2, FanoutExchange fanoutExchange){ return BindingBuilder .bind(fanoutQueue2) .to(fanoutExchange); } @Bean public Queue objectQueue(){ return new Queue("object.queue"); } }

微信网友_7134912998903808 LV15
2024年9月11日
zhujunnan LV12
2024年3月19日
erqiu2013 LV18
2023年12月27日
Seaskye LV14
2023年11月10日
shuangfu LV25
2023年10月19日
杨豫川 LV12
2023年4月27日
sunlzh888888 LV29
2023年4月23日
quyiyi LV3
2023年4月5日
最代码官方 LV168
2022年10月22日

charleswang LV7
2024年10月21日
微信网友_7134912998903808 LV15
2024年9月11日
TY0165 LV20
2024年6月17日
kenhomeliu LV29
2024年4月30日
jc121140 LV3
2024年3月25日
zhujunnan LV12
2024年3月5日
erqiu2013 LV18
2023年12月27日
安东尼online LV11
2023年12月20日
kkkxyh LV13
2023年12月7日
张晨曦 LV4
2023年11月15日