Browse Source

Improve rule nodes failure debug

pull/5225/head
Igor Kulikov 5 years ago
parent
commit
34eef0383a
  1. 16
      application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java
  2. 2
      application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java

16
application/src/main/java/org/thingsboard/server/actors/ActorSystemContext.java

@ -487,22 +487,26 @@ public class ActorSystemContext {
}
public void persistDebugInput(TenantId tenantId, EntityId entityId, TbMsg tbMsg, String relationType) {
persistDebugAsync(tenantId, entityId, "IN", tbMsg, relationType, null);
persistDebugAsync(tenantId, entityId, "IN", tbMsg, relationType, null, null);
}
public void persistDebugInput(TenantId tenantId, EntityId entityId, TbMsg tbMsg, String relationType, Throwable error) {
persistDebugAsync(tenantId, entityId, "IN", tbMsg, relationType, error);
persistDebugAsync(tenantId, entityId, "IN", tbMsg, relationType, error, null);
}
public void persistDebugOutput(TenantId tenantId, EntityId entityId, TbMsg tbMsg, String relationType, Throwable error, String failureMessage) {
persistDebugAsync(tenantId, entityId, "OUT", tbMsg, relationType, error, failureMessage);
}
public void persistDebugOutput(TenantId tenantId, EntityId entityId, TbMsg tbMsg, String relationType, Throwable error) {
persistDebugAsync(tenantId, entityId, "OUT", tbMsg, relationType, error);
persistDebugAsync(tenantId, entityId, "OUT", tbMsg, relationType, error, null);
}
public void persistDebugOutput(TenantId tenantId, EntityId entityId, TbMsg tbMsg, String relationType) {
persistDebugAsync(tenantId, entityId, "OUT", tbMsg, relationType, null);
persistDebugAsync(tenantId, entityId, "OUT", tbMsg, relationType, null, null);
}
private void persistDebugAsync(TenantId tenantId, EntityId entityId, String type, TbMsg tbMsg, String relationType, Throwable error) {
private void persistDebugAsync(TenantId tenantId, EntityId entityId, String type, TbMsg tbMsg, String relationType, Throwable error, String failureMessage) {
if (checkLimits(tenantId, tbMsg, error)) {
try {
Event event = new Event();
@ -526,6 +530,8 @@ public class ActorSystemContext {
if (error != null) {
node = node.put("error", toString(error));
} else if (failureMessage != null) {
node = node.put("error", failureMessage);
}
event.setBody(node);

2
application/src/main/java/org/thingsboard/server/actors/ruleChain/DefaultTbContext.java

@ -224,7 +224,7 @@ class DefaultTbContext implements TbContext {
}
if (nodeCtx.getSelf().isDebugMode()) {
relationTypes.forEach(relationType ->
mainCtx.persistDebugOutput(nodeCtx.getTenantId(), nodeCtx.getSelf().getId(), tbMsg, relationType));
mainCtx.persistDebugOutput(nodeCtx.getTenantId(), nodeCtx.getSelf().getId(), tbMsg, relationType, null, failureMessage));
}
mainCtx.getClusterService().pushMsgToRuleEngine(tpi, tbMsg.getId(), msg.build(), new SimpleTbQueueCallback(onSuccess, onFailure));
}

Loading…
Cancel
Save