Browse Source

Remove unnecessary isSupportedOriginator for TbPushNode in order not to support 2 places of possible types: there is check after fetching during processing edge events from db

pull/9940/head
Andrii Landiak 2 years ago
parent
commit
05f5961fac
  1. 28
      rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/edge/AbstractTbMsgPushNode.java

28
rule-engine/rule-engine-components/src/main/java/org/thingsboard/rule/engine/edge/AbstractTbMsgPushNode.java

@ -66,16 +66,10 @@ public abstract class AbstractTbMsgPushNode<T extends BaseTbMsgPushNodeConfigura
ctx.ack(msg);
return;
}
if (isSupportedOriginator(msg.getOriginator().getEntityType())) {
if (isSupportedMsgType(msg)) {
processMsg(ctx, msg);
} else {
String errMsg = String.format("Unsupported msg type %s", msg.getType());
log.debug(errMsg);
ctx.tellFailure(msg, new RuntimeException(errMsg));
}
if (isSupportedMsgType(msg)) {
processMsg(ctx, msg);
} else {
String errMsg = String.format("Unsupported originator type %s", msg.getOriginator().getEntityType());
String errMsg = String.format("Unsupported msg type %s", msg.getType());
log.debug(errMsg);
ctx.tellFailure(msg, new RuntimeException(errMsg));
}
@ -183,20 +177,4 @@ public abstract class AbstractTbMsgPushNode<T extends BaseTbMsgPushNodeConfigura
return msg.isTypeOneOf(POST_TELEMETRY_REQUEST, POST_ATTRIBUTES_REQUEST, ATTRIBUTES_UPDATED,
ATTRIBUTES_DELETED, TIMESERIES_UPDATED, ALARM, CONNECT_EVENT, DISCONNECT_EVENT, ACTIVITY_EVENT, INACTIVITY_EVENT);
}
protected boolean isSupportedOriginator(EntityType entityType) {
switch (entityType) {
case DEVICE:
case ASSET:
case ENTITY_VIEW:
case DASHBOARD:
case TENANT:
case CUSTOMER:
case USER:
case EDGE:
return true;
default:
return false;
}
}
}

Loading…
Cancel
Save