Commit 34eef0383a00463a592678282f22b75ea7a4f820

Authored by Igor Kulikov
1 parent d7731764

Improve rule nodes failure debug

... ... @@ -487,22 +487,26 @@ public class ActorSystemContext {
487 487 }
488 488
489 489 public void persistDebugInput(TenantId tenantId, EntityId entityId, TbMsg tbMsg, String relationType) {
490   - persistDebugAsync(tenantId, entityId, "IN", tbMsg, relationType, null);
  490 + persistDebugAsync(tenantId, entityId, "IN", tbMsg, relationType, null, null);
491 491 }
492 492
493 493 public void persistDebugInput(TenantId tenantId, EntityId entityId, TbMsg tbMsg, String relationType, Throwable error) {
494   - persistDebugAsync(tenantId, entityId, "IN", tbMsg, relationType, error);
  494 + persistDebugAsync(tenantId, entityId, "IN", tbMsg, relationType, error, null);
  495 + }
  496 +
  497 + public void persistDebugOutput(TenantId tenantId, EntityId entityId, TbMsg tbMsg, String relationType, Throwable error, String failureMessage) {
  498 + persistDebugAsync(tenantId, entityId, "OUT", tbMsg, relationType, error, failureMessage);
495 499 }
496 500
497 501 public void persistDebugOutput(TenantId tenantId, EntityId entityId, TbMsg tbMsg, String relationType, Throwable error) {
498   - persistDebugAsync(tenantId, entityId, "OUT", tbMsg, relationType, error);
  502 + persistDebugAsync(tenantId, entityId, "OUT", tbMsg, relationType, error, null);
499 503 }
500 504
501 505 public void persistDebugOutput(TenantId tenantId, EntityId entityId, TbMsg tbMsg, String relationType) {
502   - persistDebugAsync(tenantId, entityId, "OUT", tbMsg, relationType, null);
  506 + persistDebugAsync(tenantId, entityId, "OUT", tbMsg, relationType, null, null);
503 507 }
504 508
505   - private void persistDebugAsync(TenantId tenantId, EntityId entityId, String type, TbMsg tbMsg, String relationType, Throwable error) {
  509 + private void persistDebugAsync(TenantId tenantId, EntityId entityId, String type, TbMsg tbMsg, String relationType, Throwable error, String failureMessage) {
506 510 if (checkLimits(tenantId, tbMsg, error)) {
507 511 try {
508 512 Event event = new Event();
... ... @@ -526,6 +530,8 @@ public class ActorSystemContext {
526 530
527 531 if (error != null) {
528 532 node = node.put("error", toString(error));
  533 + } else if (failureMessage != null) {
  534 + node = node.put("error", failureMessage);
529 535 }
530 536
531 537 event.setBody(node);
... ...
... ... @@ -224,7 +224,7 @@ class DefaultTbContext implements TbContext {
224 224 }
225 225 if (nodeCtx.getSelf().isDebugMode()) {
226 226 relationTypes.forEach(relationType ->
227   - mainCtx.persistDebugOutput(nodeCtx.getTenantId(), nodeCtx.getSelf().getId(), tbMsg, relationType));
  227 + mainCtx.persistDebugOutput(nodeCtx.getTenantId(), nodeCtx.getSelf().getId(), tbMsg, relationType, null, failureMessage));
228 228 }
229 229 mainCtx.getClusterService().pushMsgToRuleEngine(tpi, tbMsg.getId(), msg.build(), new SimpleTbQueueCallback(onSuccess, onFailure));
230 230 }
... ...