提交 | 用户 | 时间
|
191b3d
|
1 |
package com.iailab.module.data.mq.config; |
H |
2 |
|
|
3 |
import com.iailab.module.data.mq.consumer.ImageMessage; |
|
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 Houzhongjian |
|
13 |
* @Description |
|
14 |
* @createTime 2024年11月06日 |
|
15 |
*/ |
|
16 |
@Configuration |
|
17 |
public class TopicImageRabbitConfig { |
|
18 |
//绑定键 |
|
19 |
public final static String routingDahua = ImageMessage.DAHUA_ROUTING_KEY; |
|
20 |
public final static String routingHikvison = ImageMessage.HIKVISION_ROUTING_KEY; |
|
21 |
|
|
22 |
@Bean |
|
23 |
public Queue imageDahuaQueue() { |
|
24 |
return new Queue(TopicImageRabbitConfig.routingDahua); |
|
25 |
} |
|
26 |
|
|
27 |
@Bean |
|
28 |
public Queue imageHikvisionQueue() { |
|
29 |
return new Queue(TopicImageRabbitConfig.routingHikvison); |
|
30 |
} |
|
31 |
|
|
32 |
@Bean |
|
33 |
TopicExchange exchange() { |
|
34 |
return new TopicExchange(ImageMessage.EXCHANGE); |
|
35 |
} |
|
36 |
|
|
37 |
// 注意通配符*和#的用法 |
|
38 |
@Bean |
|
39 |
Binding bindingExchangeMessageDH() { |
|
40 |
return BindingBuilder.bind(imageDahuaQueue()).to(exchange()).with(routingDahua); |
|
41 |
} |
|
42 |
|
|
43 |
@Bean |
|
44 |
Binding bindingExchangeMessageHK() { |
|
45 |
return BindingBuilder.bind(imageHikvisionQueue()).to(exchange()).with(routingHikvison); |
|
46 |
} |
|
47 |
|
|
48 |
} |