沙钢智慧能源系统后端代码
潘志宝
2024-12-11 c9ff6a7f2e89f751e2eec68ec02fa93919d05296
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package com.iailab.module.shasteel.mq.config;
 
import com.iailab.module.shasteel.mq.common.RoutingConstant;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
 
/**
 * 绑定队列
 *
 * @author lirm
 * @Description
 * @createTime 2024年11月27日
 */
@Configuration
public class QueueModelAlarmConfig {
    // 队列名称
    public final static String QUEUE_NAME = "IaiabFastShateel.Model.Alarm";
 
    @Bean
    public Queue alarmQueue() {
        return new Queue(QUEUE_NAME);
    }
 
    @Bean
    TopicExchange alarmExchange() {
        return new TopicExchange(RoutingConstant.EXCHANGE);
    }
 
    // 注意通配符*和#的用法
    @Bean
    Binding bindingExchangeMessageAlarm() {
        return BindingBuilder.bind(alarmQueue()).to(alarmExchange()).with(RoutingConstant.Iailab_Model_Alarm);
    }
}