package com.prolog.cs.biz.outbound.service.impl;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.prolog.framework.utils.JsonUtils;
import com.prolog.upcloud.base.inventory.vo.InvStockWave;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;


public class WaveServiceRbMQ
{

    @Autowired
    private AmqpTemplate amqpTemplate;
    private static final Log log = LogFactory.getLog(WaveServiceRbMQ.class);

    public void send(InvStockWave waveInfo)
    {
        assert waveInfo != null;
        String s = null;
        try
        {
            s = JsonUtils.toString(waveInfo);
            log.info("start send wave info");
            log.info(s);
        } catch (JsonProcessingException e)
        {
            throw new RuntimeException(e);
        }
        //通知出库服务
        amqpTemplate.convertAndSend("waveTopicExchange", "topic.wave.request", s);
    }
}
