EDQS: added error handling while data sync
This commit is contained in:
parent
7e010385f1
commit
1f242df5eb
@ -161,13 +161,17 @@ public abstract class EdqsSyncService {
|
|||||||
|
|
||||||
private void processRelationBatch(List<RelationEntity> relations) {
|
private void processRelationBatch(List<RelationEntity> relations) {
|
||||||
for (RelationEntity relation : relations) {
|
for (RelationEntity relation : relations) {
|
||||||
if (RelationTypeGroup.COMMON.name().equals(relation.getRelationTypeGroup())) {
|
try {
|
||||||
EntityIdInfo entityIdInfo = entityInfoMap.get(relation.getFromId());
|
if (RelationTypeGroup.COMMON.name().equals(relation.getRelationTypeGroup())) {
|
||||||
if (entityIdInfo != null) {
|
EntityIdInfo entityIdInfo = entityInfoMap.get(relation.getFromId());
|
||||||
process(entityIdInfo.tenantId(), RELATION, relation.toData());
|
if (entityIdInfo != null) {
|
||||||
} else {
|
process(entityIdInfo.tenantId(), RELATION, relation.toData());
|
||||||
log.info("Relation from id not found: {} ", relation);
|
} else {
|
||||||
|
log.info("Relation from id not found: {} ", relation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Failed to sync relation batch: {}", relation, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,19 +211,23 @@ public abstract class EdqsSyncService {
|
|||||||
|
|
||||||
private void processAttributeBatch(List<AttributeKvEntity> batch) {
|
private void processAttributeBatch(List<AttributeKvEntity> batch) {
|
||||||
for (AttributeKvEntity attribute : batch) {
|
for (AttributeKvEntity attribute : batch) {
|
||||||
attribute.setStrKey(getStrKeyOrFetchFromDb(attribute.getId().getAttributeKey()));
|
try {
|
||||||
UUID entityId = attribute.getId().getEntityId();
|
attribute.setStrKey(getStrKeyOrFetchFromDb(attribute.getId().getAttributeKey()));
|
||||||
EntityIdInfo entityIdInfo = entityInfoMap.get(entityId);
|
UUID entityId = attribute.getId().getEntityId();
|
||||||
if (entityIdInfo == null) {
|
EntityIdInfo entityIdInfo = entityInfoMap.get(entityId);
|
||||||
log.debug("Skipping attribute with entity UUID {} as it is not found in entityInfoMap", entityId);
|
if (entityIdInfo == null) {
|
||||||
continue;
|
log.debug("Skipping attribute with entity UUID {} as it is not found in entityInfoMap", entityId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
AttributeKv attributeKv = new AttributeKv(
|
||||||
|
EntityIdFactory.getByTypeAndUuid(entityIdInfo.entityType(), entityId),
|
||||||
|
AttributeScope.valueOf(attribute.getId().getAttributeType()),
|
||||||
|
attribute.toData(),
|
||||||
|
attribute.getVersion());
|
||||||
|
process(entityIdInfo.tenantId(), ATTRIBUTE_KV, attributeKv);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("Failed to sync attribute batch: {}", attribute, e);
|
||||||
}
|
}
|
||||||
AttributeKv attributeKv = new AttributeKv(
|
|
||||||
EntityIdFactory.getByTypeAndUuid(entityIdInfo.entityType(), entityId),
|
|
||||||
AttributeScope.valueOf(attribute.getId().getAttributeType()),
|
|
||||||
attribute.toData(),
|
|
||||||
attribute.getVersion());
|
|
||||||
process(entityIdInfo.tenantId(), ATTRIBUTE_KV, attributeKv);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user