沙钢智慧能源系统后端代码
dengzedong
2024-12-06 77a5ab85c55cdd84b311b1d67d35ba4663be8b93
提交 | 用户 | 时间
8766cf 1 package com.iailab.module.shasteel.mq.config;
L 2
3 import com.iailab.module.shasteel.mq.consumer.PredictFinishMessage;
4 import org.springframework.amqp.core.Binding;
5 import org.springframework.amqp.core.BindingBuilder;
6 import org.springframework.amqp.core.Queue;
7 import org.springframework.amqp.core.TopicExchange;
8 import org.springframework.context.annotation.Bean;
9 import org.springframework.context.annotation.Configuration;
10
11 /**
12  * @author lirm
13  * @Description
14  * @createTime 2024年11月27日
15  */
16 @Configuration
17 public class TopicPredictFinishRabbitConfig {
18     //绑定键
19     public final static String routingPredictFinish = PredictFinishMessage.PREDICTFINISH_ROUTING_KEY;
20
21     @Bean
22     public Queue predictFinishQueue() {
23         return new Queue(TopicPredictFinishRabbitConfig.routingPredictFinish);
24     }
25
26     @Bean
f0a800 27     TopicExchange predictFinishExchange() {
8766cf 28         return new TopicExchange(PredictFinishMessage.EXCHANGE);
L 29     }
30
31     // 注意通配符*和#的用法
32     @Bean
f0a800 33     Binding bindingExchangeMessagePF() {
L 34         return BindingBuilder.bind(predictFinishQueue()).to(predictFinishExchange()).with(routingPredictFinish);
8766cf 35     }
L 36 }