|
@@ -2,6 +2,7 @@ package com.persagy.apm.alarmservice.common.jms;
|
|
|
|
|
|
import cn.hutool.core.lang.generator.UUIDGenerator;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.google.common.collect.Lists;
|
|
|
import com.persagy.apm.alarmservice.common.configuration.rabbitmq.JacksonMapper;
|
|
|
import com.persagy.apm.alarmservice.common.enums.JmsTypeEnum;
|
|
|
import com.persagy.apm.alarmservice.common.model.DmpMessage;
|
|
@@ -171,12 +172,18 @@ public class JmsSender {
|
|
|
if (CollectionUtils.isEmpty(relList)) {
|
|
|
return;
|
|
|
}
|
|
|
- UUIDGenerator uuidGenerator = new UUIDGenerator();
|
|
|
- dmpMessage.setMid(uuidGenerator.next());
|
|
|
- dmpMessage.setStr1(JSONObject.toJSONString(relList));
|
|
|
- dmpMessage.setType(JmsTypeEnum.NEW_OBJ_CONDITION_REL.getType());
|
|
|
|
|
|
- sendObjConditionRelMsg(dmpMessage);
|
|
|
+ // 因为阿里云mq单个消息限制大小为64k。将关联关系消息分批放入mq,每次发送200条数据
|
|
|
+ int onceSendCount = 200;
|
|
|
+ List<List<ObjConditionRel>> partition = Lists.partition(relList, onceSendCount);
|
|
|
+
|
|
|
+ for (List<ObjConditionRel> objConditionRels : partition) {
|
|
|
+ UUIDGenerator uuidGenerator = new UUIDGenerator();
|
|
|
+ dmpMessage.setMid(uuidGenerator.next());
|
|
|
+ dmpMessage.setStr1(JSONObject.toJSONString(objConditionRels));
|
|
|
+ dmpMessage.setType(JmsTypeEnum.NEW_OBJ_CONDITION_REL.getType());
|
|
|
+ sendObjConditionRelMsg(dmpMessage);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|