Commit e90a2295 by songxiang

还原代码

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