|
@@ -18,19 +18,31 @@ import org.springframework.context.annotation.Configuration;
|
|
|
@Configuration
|
|
|
public class RabbitMQConfig {
|
|
|
|
|
|
- @Value("${spring.rabbitmq.send.socket.queue}")
|
|
|
- public String queue;
|
|
|
-
|
|
|
@Value("${spring.rabbitmq.send.socket.exchange}")
|
|
|
public String exchange;
|
|
|
|
|
|
@Value("${spring.rabbitmq.send.socket.routingKey}")
|
|
|
public String routingKey;
|
|
|
|
|
|
+ @Value("${spring.rabbitmq.send.socket.queue}")
|
|
|
+ public String queue;
|
|
|
+
|
|
|
+ @Value("${spring.rabbitmq.send.socket.instructionsRoutingKey}")
|
|
|
+ public String instructionsRoutingKey;
|
|
|
+
|
|
|
+ @Value("${spring.rabbitmq.send.socket.instructionsQueue}")
|
|
|
+ public String instructionsQueue;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * rabbitMq里初始化exchange.
|
|
|
+ */
|
|
|
+ @Bean
|
|
|
+ public TopicExchange exchange() {
|
|
|
+ return new TopicExchange(exchange);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* rabbitMq里初始化队列queue.
|
|
|
- *
|
|
|
- * @return
|
|
|
*/
|
|
|
@Bean
|
|
|
public Queue queue() {
|
|
@@ -38,22 +50,27 @@ public class RabbitMQConfig {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * rabbitMq里初始化exchange.
|
|
|
- *
|
|
|
- * @return
|
|
|
+ * 绑定exchange & queue & routekey.
|
|
|
*/
|
|
|
@Bean
|
|
|
- public TopicExchange exchange() {
|
|
|
- return new TopicExchange(exchange);
|
|
|
+ public Binding bindingExchange() {
|
|
|
+ return BindingBuilder.bind(queue()).to(exchange()).with(routingKey);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * rabbitMq里初始化队列queue.
|
|
|
+ */
|
|
|
+ @Bean
|
|
|
+ public Queue instructionsQueue() {
|
|
|
+ return new Queue(instructionsQueue);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 绑定exchange & queue & routekey.
|
|
|
- *
|
|
|
- * @return
|
|
|
*/
|
|
|
@Bean
|
|
|
- public Binding bindingExchange() {
|
|
|
- return BindingBuilder.bind(queue()).to(exchange()).with(routingKey);
|
|
|
+ public Binding bindingInstructionsExchange() {
|
|
|
+ return BindingBuilder.bind(instructionsQueue()).to(exchange()).with(instructionsRoutingKey);
|
|
|
}
|
|
|
+
|
|
|
}
|