|
|
@@ -16,6 +16,7 @@ import com.uas.ps.inquiry.page.criteria.LogicalExpression;
|
|
|
import com.uas.ps.inquiry.page.criteria.PredicateUtils;
|
|
|
import com.uas.ps.inquiry.page.criteria.SimpleExpression;
|
|
|
import com.uas.ps.inquiry.page.exception.IllegalOperatorException;
|
|
|
+import com.uas.ps.inquiry.rabbit.MessageInfo;
|
|
|
import com.uas.ps.inquiry.rabbit.RabbitConstants;
|
|
|
import com.uas.ps.inquiry.service.InquiryService;
|
|
|
import com.uas.ps.inquiry.service.PublicInquiryService;
|
|
|
@@ -27,6 +28,7 @@ import javassist.NotFoundException;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
|
+import org.springframework.amqp.rabbit.support.CorrelationData;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.Sort;
|
|
|
@@ -878,7 +880,17 @@ public class InquiryServiceImpl implements InquiryService {
|
|
|
model.setSmTemplate(SMS_TEMP_ID);
|
|
|
models.add(model);
|
|
|
long start = System.currentTimeMillis();
|
|
|
- rabbitTemplate.convertAndSend(RabbitConstants.AMQ_DIRECT, RabbitConstants.INQUIRY_MESSAGE_ROUTINGKEY, models);
|
|
|
+
|
|
|
+ //设置消息ID
|
|
|
+ MessageInfo messageInfo = new MessageInfo();
|
|
|
+ messageInfo.setMsgId(UUID.randomUUID().toString());
|
|
|
+ //设置时间戳
|
|
|
+ messageInfo.setTimestamp(System.currentTimeMillis());
|
|
|
+ messageInfo.setData(models);
|
|
|
+ CorrelationData correlationData = new CorrelationData(messageInfo.getMsgId());
|
|
|
+ rabbitTemplate.convertAndSend(RabbitConstants.AMQ_DIRECT, RabbitConstants.INQUIRY_MESSAGE_ROUTINGKEY, messageInfo, correlationData);
|
|
|
+
|
|
|
+
|
|
|
log.info("/message 耗时:{},消息数:{}", (System.currentTimeMillis() - start), models.size());
|
|
|
log.info("公共询价", "此次{}公司新增{}张公共询价", company, count);
|
|
|
} catch (Exception e) {
|
|
|
@@ -928,7 +940,18 @@ public class InquiryServiceImpl implements InquiryService {
|
|
|
}
|
|
|
if (models.size() >= 500) {
|
|
|
long start = System.currentTimeMillis();
|
|
|
- rabbitTemplate.convertAndSend(RabbitConstants.AMQ_DIRECT, RabbitConstants.INQUIRY_MESSAGE_ROUTINGKEY, models);
|
|
|
+
|
|
|
+
|
|
|
+ //设置消息ID
|
|
|
+ MessageInfo messageInfo = new MessageInfo();
|
|
|
+ messageInfo.setMsgId(UUID.randomUUID().toString());
|
|
|
+ //设置时间戳
|
|
|
+ messageInfo.setTimestamp(System.currentTimeMillis());
|
|
|
+ messageInfo.setData(models);
|
|
|
+ CorrelationData correlationData = new CorrelationData(messageInfo.getMsgId());
|
|
|
+ rabbitTemplate.convertAndSend(RabbitConstants.AMQ_DIRECT, RabbitConstants.INQUIRY_MESSAGE_ROUTINGKEY, messageInfo, correlationData);
|
|
|
+
|
|
|
+
|
|
|
log.info("消息中心生成消息");
|
|
|
log.info("发送消息{},耗时:{}", models.size(), (System.currentTimeMillis() - start));
|
|
|
models = new ArrayList<>();
|
|
|
@@ -936,7 +959,17 @@ public class InquiryServiceImpl implements InquiryService {
|
|
|
}
|
|
|
if (!CollectionUtils.isEmpty(models)) {
|
|
|
long start = System.currentTimeMillis();
|
|
|
- rabbitTemplate.convertAndSend(RabbitConstants.AMQ_DIRECT, RabbitConstants.INQUIRY_MESSAGE_ROUTINGKEY, models);
|
|
|
+
|
|
|
+ //设置消息ID
|
|
|
+ MessageInfo messageInfo = new MessageInfo();
|
|
|
+ messageInfo.setMsgId(UUID.randomUUID().toString());
|
|
|
+ //设置时间戳
|
|
|
+ messageInfo.setTimestamp(System.currentTimeMillis());
|
|
|
+ messageInfo.setData(models);
|
|
|
+ CorrelationData correlationData = new CorrelationData(messageInfo.getMsgId());
|
|
|
+ rabbitTemplate.convertAndSend(RabbitConstants.AMQ_DIRECT, RabbitConstants.INQUIRY_MESSAGE_ROUTINGKEY, messageInfo, correlationData);
|
|
|
+
|
|
|
+
|
|
|
log.info("消息中心生成消息");
|
|
|
log.info("发送消息{},耗时:{}", models.size(), (System.currentTimeMillis() - start));
|
|
|
}
|