Commit e90a2295 by songxiang

还原代码

parent 86a06497
...@@ -3,13 +3,19 @@ ...@@ -3,13 +3,19 @@
*/ */
package com.pcloud.common.core.biz.impl; package com.pcloud.common.core.biz.impl;
import org.springframework.amqp.core.AmqpTemplate; 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.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;
...@@ -22,16 +28,33 @@ import com.pcloud.common.exceptions.BizException; ...@@ -22,16 +28,33 @@ 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 {
amqpTemplate.convertAndSend(MQQueueConstant.TRANSCODE, transcodeMQDTO); 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