Merge pull request #9940 from AndriiLandiak/fix/edge-msg-push-node-improvement
Edge - optimization: eliminate duplicate type checks in TbMsgPushNode
This commit is contained in:
commit
201c2a994e
@ -66,7 +66,6 @@ public abstract class AbstractTbMsgPushNode<T extends BaseTbMsgPushNodeConfigura
|
|||||||
ctx.ack(msg);
|
ctx.ack(msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isSupportedOriginator(msg.getOriginator().getEntityType())) {
|
|
||||||
if (isSupportedMsgType(msg)) {
|
if (isSupportedMsgType(msg)) {
|
||||||
processMsg(ctx, msg);
|
processMsg(ctx, msg);
|
||||||
} else {
|
} else {
|
||||||
@ -74,11 +73,6 @@ public abstract class AbstractTbMsgPushNode<T extends BaseTbMsgPushNodeConfigura
|
|||||||
log.debug(errMsg);
|
log.debug(errMsg);
|
||||||
ctx.tellFailure(msg, new RuntimeException(errMsg));
|
ctx.tellFailure(msg, new RuntimeException(errMsg));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
String errMsg = String.format("Unsupported originator type %s", msg.getOriginator().getEntityType());
|
|
||||||
log.debug(errMsg);
|
|
||||||
ctx.tellFailure(msg, new RuntimeException(errMsg));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected S buildEvent(TbMsg msg, TbContext ctx) {
|
protected S buildEvent(TbMsg msg, TbContext ctx) {
|
||||||
@ -183,20 +177,4 @@ public abstract class AbstractTbMsgPushNode<T extends BaseTbMsgPushNodeConfigura
|
|||||||
return msg.isTypeOneOf(POST_TELEMETRY_REQUEST, POST_ATTRIBUTES_REQUEST, ATTRIBUTES_UPDATED,
|
return msg.isTypeOneOf(POST_TELEMETRY_REQUEST, POST_ATTRIBUTES_REQUEST, ATTRIBUTES_UPDATED,
|
||||||
ATTRIBUTES_DELETED, TIMESERIES_UPDATED, ALARM, CONNECT_EVENT, DISCONNECT_EVENT, ACTIVITY_EVENT, INACTIVITY_EVENT);
|
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…
x
Reference in New Issue
Block a user