Commit 86a06497 by songxiang

transcode修改成RabbitMQ

parent 2fea6064
...@@ -3,19 +3,13 @@ ...@@ -3,19 +3,13 @@
*/ */
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 javax.jms.Session;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; 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 org.springframework.stereotype.Service;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.biz.TranscodeQueueBiz; 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.core.dto.TranscodeMQDTO;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
...@@ -28,33 +22,16 @@ import com.pcloud.common.exceptions.BizException; ...@@ -28,33 +22,16 @@ import com.pcloud.common.exceptions.BizException;
@Service("transcodeQueueBiz") @Service("transcodeQueueBiz")
public class TranscodeQueueBizImpl implements TranscodeQueueBiz { public class TranscodeQueueBizImpl implements TranscodeQueueBiz {
/** @Autowired
* private AmqpTemplate amqpTemplate;
*/
private final static Logger logger = LoggerFactory.getLogger(TranscodeQueueBizImpl.class);
@Autowired(required = false)
@Qualifier("jmsTranscodeTemplate")
private JmsTemplate jmsTranscodeTemplate;
/** /**
* * 文件转码QUEUE
*/ */
@Override @Override
@ParamLog(description = "文件转码QUEUE")
public void sendTranscodeQueue(TranscodeMQDTO transcodeMQDTO) throws BizException { public void sendTranscodeQueue(TranscodeMQDTO transcodeMQDTO) throws BizException {
MessageCreator messageCreator = new MessageCreator() { amqpTemplate.convertAndSend(MQQueueConstant.TRANSCODE, transcodeMQDTO);
@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