Commit 60ff567f by huvchao@126.com

orderDeliveryQueue

parent 843ee1d4
......@@ -21,6 +21,10 @@ public class PushOrderConfig {
public static final String PUSH_ORDER_QUEUE = "push-order-queue";
public static final String PUSH_ORDER_QUEUE_ROUTING_KEY = "push-order-queue-routing-key";
// 配送信息消息队列
public static final String OPEN_PLATFORM_ORDER_DELIVERY_QUEUE = "open-platform-order-delivery-queue";
public static final String OPEN_PLATFORM_ORDER_DELIVERY_ROUTING_KEY = "open-platform-order-delivery-routing-key";
/**
* 定义基于Fanout 的Exchange。
* 基于这个代码,也可以非常方便的定义其他的Exchange类型。
......@@ -58,4 +62,13 @@ public class PushOrderConfig {
public OrderMQService orderMQService() {
return new OrderMQService();
}
@Bean
public Queue orderDeliveryQueue(){
return QueueBuilder.durable(OPEN_PLATFORM_ORDER_DELIVERY_QUEUE).build();
}
@Bean
Binding bindingOrderDeliveryQueue(Queue orderDeliveryQueue, Exchange topicExchange) {
return BindingBuilder.bind(orderDeliveryQueue).to(topicExchange).with(OPEN_PLATFORM_ORDER_DELIVERY_ROUTING_KEY).noargs();
}
}
package cn.freemud.amp.service;
import cn.freemud.amp.config.PushOrderConfig;
import cn.freemud.amqp.MQMessage;
import cn.freemud.amqp.MQService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -13,15 +14,12 @@ public class ProduceMQService {
@Autowired
private MQService mqService;
private static final String exchangeName = "topic-Exchange";
private static final String routeKey = "open-platform-order-delivery-routing-key";
/**
* 发送配送状态变更信息
* @param body
*/
public void sendOfDeliveryInfo(MQMessage body) {
mqService.convertAndSend(exchangeName, routeKey, body);
mqService.convertAndSend(PushOrderConfig.EXCHANGE_NAME, PushOrderConfig.OPEN_PLATFORM_ORDER_DELIVERY_ROUTING_KEY, body);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment