package cn.freemud.amp.service;

import cn.freemud.amp.body.OrderBody;
import cn.freemud.amp.config.PushOrderConfig;
import cn.freemud.amqp.Header;
import cn.freemud.amqp.MQMessage;
import cn.freemud.amqp.MQService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * All rights Reserved, Designed By www.freemud.cn
 *
 * @version V1.0
 * @Title: ${FILE_NAME}
 * @Package com.freemud.mail.core
 * @Description: ${TODO}(用一句话描述该文件做什么)
 * @author: aiqi.gong
 * @date: 2019/3/19 20:00
 * @Copyright: 2018 www.freemud.cn Inc. All rights reserved.
 * 注意：本内容仅限于上海非码科技内部传阅，禁止外泄以及用于其他的商业目
 */
public class OrderMQService {
    @Autowired
    private MQService mqService;

    private static final String TEST = "test";


    public void sendOrderMQ(OrderBody orderBody) {
        MQMessage<OrderBody> orderBodyMQMessage = new MQMessage<>();
        Header header = new Header();
        orderBodyMQMessage.setHeader(header);
        orderBodyMQMessage.setBody(orderBody);
        mqService.convertAndSend(PushOrderConfig.EXCHANGE_NAME, PushOrderConfig.PUSH_ORDER_QUEUE_ROUTING_KEY, orderBodyMQMessage);
    }
}
