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