|
|
|
@ -844,7 +844,7 @@ public abstract class BaseController { |
|
|
|
try { |
|
|
|
if (!relation.getFrom().getEntityType().equals(EntityType.EDGE) && |
|
|
|
!relation.getTo().getEntityType().equals(EntityType.EDGE)) { |
|
|
|
sendNotificationMsgToEdgeService(tenantId, null, null, json.writeValueAsString(relation), EdgeEventType.RELATION, action); |
|
|
|
sendNotificationMsgToEdge(tenantId, null, null, json.writeValueAsString(relation), EdgeEventType.RELATION, action); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
log.warn("Failed to push relation to core: {}", relation, e); |
|
|
|
@ -858,7 +858,7 @@ public abstract class BaseController { |
|
|
|
protected void sendDeleteNotificationMsg(TenantId tenantId, EntityId entityId, List<EdgeId> edgeIds, String body) { |
|
|
|
if (edgeIds != null && !edgeIds.isEmpty()) { |
|
|
|
for (EdgeId edgeId : edgeIds) { |
|
|
|
sendNotificationMsgToEdgeService(tenantId, edgeId, entityId, body, null, EdgeEventActionType.DELETED); |
|
|
|
sendNotificationMsgToEdge(tenantId, edgeId, entityId, body, null, EdgeEventActionType.DELETED); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -873,22 +873,22 @@ public abstract class BaseController { |
|
|
|
|
|
|
|
protected void sendEntityAssignToCustomerNotificationMsg(TenantId tenantId, EntityId entityId, CustomerId customerId, EdgeEventActionType action) { |
|
|
|
try { |
|
|
|
sendNotificationMsgToEdgeService(tenantId, null, entityId, json.writeValueAsString(customerId), null, action); |
|
|
|
sendNotificationMsgToEdge(tenantId, null, entityId, json.writeValueAsString(customerId), null, action); |
|
|
|
} catch (Exception e) { |
|
|
|
log.warn("Failed to push assign/unassign to/from customer to core: {}", customerId, e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected void sendEntityNotificationMsg(TenantId tenantId, EntityId entityId, EdgeEventActionType action) { |
|
|
|
sendNotificationMsgToEdgeService(tenantId, null, entityId, null, null, action); |
|
|
|
sendNotificationMsgToEdge(tenantId, null, entityId, null, null, action); |
|
|
|
} |
|
|
|
|
|
|
|
protected void sendEntityAssignToEdgeNotificationMsg(TenantId tenantId, EdgeId edgeId, EntityId entityId, EdgeEventActionType action) { |
|
|
|
sendNotificationMsgToEdgeService(tenantId, edgeId, entityId, null, null, action); |
|
|
|
sendNotificationMsgToEdge(tenantId, edgeId, entityId, null, null, action); |
|
|
|
} |
|
|
|
|
|
|
|
private void sendNotificationMsgToEdgeService(TenantId tenantId, EdgeId edgeId, EntityId entityId, String body, EdgeEventType type, EdgeEventActionType action) { |
|
|
|
tbClusterService.sendNotificationMsgToEdgeService(tenantId, edgeId, entityId, body, type, action); |
|
|
|
private void sendNotificationMsgToEdge(TenantId tenantId, EdgeId edgeId, EntityId entityId, String body, EdgeEventType type, EdgeEventActionType action) { |
|
|
|
tbClusterService.sendNotificationMsgToEdge(tenantId, edgeId, entityId, body, type, action); |
|
|
|
} |
|
|
|
|
|
|
|
protected List<EdgeId> findRelatedEdgeIds(TenantId tenantId, EntityId entityId) { |
|
|
|
|