Commit 86a06497 by songxiang

transcode修改成RabbitMQ

parent 2fea6064
/** /**
* *
*/ */
package com.pcloud.common.core.biz.impl; package com.pcloud.common.core.biz.impl;
import javax.jms.JMSException; import org.springframework.amqp.core.AmqpTemplate;
import javax.jms.ObjectMessage; import org.springframework.beans.factory.annotation.Autowired;
import javax.jms.Session; import org.springframework.stereotype.Service;
import org.slf4j.Logger; import com.pcloud.common.core.aspect.ParamLog;
import org.slf4j.LoggerFactory; import com.pcloud.common.core.biz.TranscodeQueueBiz;
import org.springframework.beans.factory.annotation.Autowired; import com.pcloud.common.core.constant.MQQueueConstant;
import org.springframework.beans.factory.annotation.Qualifier; import com.pcloud.common.core.dto.TranscodeMQDTO;
import org.springframework.jms.core.JmsTemplate; import com.pcloud.common.exceptions.BizException;
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; * @author:songx
import com.pcloud.common.exceptions.BizException; * @date:2018年5月17日,下午4:19:54
*/
/** @Service("transcodeQueueBiz")
* public class TranscodeQueueBizImpl implements TranscodeQueueBiz {
*
* @author:songx @Autowired
* @date:2018年5月17日,下午4:19:54 private AmqpTemplate amqpTemplate;
*/
@Service("transcodeQueueBiz") /**
public class TranscodeQueueBizImpl implements TranscodeQueueBiz { * 文件转码QUEUE
*/
/** @Override
* @ParamLog(description = "文件转码QUEUE")
*/ public void sendTranscodeQueue(TranscodeMQDTO transcodeMQDTO) throws BizException {
private final static Logger logger = LoggerFactory.getLogger(TranscodeQueueBizImpl.class); amqpTemplate.convertAndSend(MQQueueConstant.TRANSCODE, transcodeMQDTO);
}
@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