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