fix:优化文档转换组件的消息队列
This commit is contained in:
@@ -20,6 +20,7 @@ import com.adc.da.util.http.ResponseMessage;
|
||||
import com.adc.da.util.http.Result;
|
||||
import com.adc.da.util.utils.StringUtils;
|
||||
import com.adc.da.util.utils.UUID;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.rabbitmq.client.Channel;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -40,7 +41,7 @@ import java.util.Map;
|
||||
@Component
|
||||
public class SendConvertMQService {
|
||||
|
||||
// 文档转换远程服务IP地址s
|
||||
// 文档转换远程服务IP地址
|
||||
@Value("${convert.host}")
|
||||
private String convertHost;
|
||||
|
||||
@@ -74,9 +75,11 @@ public class SendConvertMQService {
|
||||
value = @Queue(value = "createConvertStandMQ_SQ_GSAR_RELEASE", durable = "true"),
|
||||
exchange = @Exchange(value = "convert-exchange_SQ_GSAR_RELEASE", ignoreDeclarationExceptions = "true"),
|
||||
key = "convert-key_SQ_GSAR_RELEASE"))
|
||||
public void createMQ(Map<String,Object> convertInfo, Message message, Channel channel) throws Exception{
|
||||
public void createMQ(Message message, Channel channel) throws Exception{
|
||||
try{
|
||||
try{
|
||||
String messagePayload = (String) message.getPayload();
|
||||
Map<String,Object> convertInfo = JSONObject.parseObject(messagePayload, Map.class);
|
||||
Thread.sleep(5000);
|
||||
insertConvertMsg(convertInfo);
|
||||
}catch(InterruptedException e){
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.adc.da.mq;
|
||||
import com.adc.da.slrs.otConvertMq.dao.OtConvertMqDao;
|
||||
import com.adc.da.slrs.otConvertMq.entity.OtConvertMq;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.amqp.core.AmqpTemplate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -69,9 +70,9 @@ public class CreateMQService {
|
||||
convertInfo.put("standFilePdfId", convert.getPdfId());
|
||||
convertInfo.put("againNum",convert.getAgainNum());
|
||||
}
|
||||
|
||||
String body = JSONObject.toJSONString(convertInfo);
|
||||
//发送消息队列
|
||||
this.rabbitTemplate.convertAndSend("convert-exchange_SQ_GSAR_RELEASE", "convert-key_SQ_GSAR_RELEASE", convertInfo);
|
||||
this.rabbitTemplate.convertAndSend("convert-exchange_SQ_GSAR_RELEASE", "convert-key_SQ_GSAR_RELEASE", body);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user