Commit e90a2295 by songxiang

还原代码

parent 86a06497
/**
*
*/
package com.pcloud.common.core.biz.impl;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.biz.TranscodeQueueBiz;
import com.pcloud.common.core.constant.MQQueueConstant;
import com.pcloud.common.core.dto.TranscodeMQDTO;
import com.pcloud.common.exceptions.BizException;
/**
*
*
* @author:songx
* @date:2018年5月17日,下午4:19:54
*/
@Service("transcodeQueueBiz")
public class TranscodeQueueBizImpl implements TranscodeQueueBiz {
@Autowired
private AmqpTemplate amqpTemplate;
/**
* 文件转码QUEUE
*/
@Override
@ParamLog(description = "文件转码QUEUE")
public void sendTranscodeQueue(TranscodeMQDTO transcodeMQDTO) throws BizException {
amqpTemplate.convertAndSend(MQQueueConstant.TRANSCODE, transcodeMQDTO);
}
}
/**
*
*/
package com.pcloud.common.core.biz.impl;
import javax.jms.JMSException;
import javax.jms.ObjectMessage;
import javax.jms.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import org.springframework.stereotype.Service;
import com.pcloud.common.core.biz.TranscodeQueueBiz;
import com.pcloud.common.core.dto.TranscodeMQDTO;
import com.pcloud.common.exceptions.BizException;
/**
*
*
* @author:songx
* @date:2018年5月17日,下午4:19:54
*/
@Service("transcodeQueueBiz")
public class TranscodeQueueBizImpl implements TranscodeQueueBiz {
/**
*
*/
private final static Logger logger = LoggerFactory.getLogger(TranscodeQueueBizImpl.class);
@Autowired(required = false)
@Qualifier("jmsTranscodeTemplate")
private JmsTemplate jmsTranscodeTemplate;
/**
*
*/
@Override
public void sendTranscodeQueue(TranscodeMQDTO transcodeMQDTO) throws BizException {
MessageCreator messageCreator = new MessageCreator() {
@Override
public ObjectMessage createMessage(Session session) throws JMSException {
return session.createObjectMessage(transcodeMQDTO);
}
};
try {
jmsTranscodeTemplate.send(messageCreator);
} catch (Exception e) {
logger.error("【文件转码】MQ发送失败:" + e.getMessage(), e);
throw BizException.SEND_QUEUE_FAIL;
}
logger.info("【文件转码】MQ发送成功.[transcodeMQDTO]=" + transcodeMQDTO);
}
}
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