Added support for dashboard telemetry and attributes update

This commit is contained in:
Volodymyr Babak 2020-06-26 11:53:16 +03:00
parent a5d75e3800
commit 4cf29e2d89
2 changed files with 9 additions and 5 deletions

View File

@ -248,7 +248,7 @@ public final class EdgeGrpcSession implements Closeable {
} else { } else {
return 0L; return 0L;
} }
}, MoreExecutors.directExecutor()); }, ctx.getDbCallbackExecutor());
} }
private void updateQueueStartTs(Long newStartTs) { private void updateQueueStartTs(Long newStartTs) {
@ -270,7 +270,9 @@ public final class EdgeGrpcSession implements Closeable {
case ENTITY_VIEW: case ENTITY_VIEW:
entityId = new EntityViewId(edgeEvent.getEntityId()); entityId = new EntityViewId(edgeEvent.getEntityId());
break; break;
case DASHBOARD:
entityId = new DashboardId(edgeEvent.getEntityId());
break;
} }
if (entityId != null) { if (entityId != null) {
log.debug("Sending telemetry data msg, entityId [{}], body [{}]", edgeEvent.getEntityId(), edgeEvent.getEntityBody()); log.debug("Sending telemetry data msg, entityId [{}], body [{}]", edgeEvent.getEntityId(), edgeEvent.getEntityBody());
@ -290,7 +292,7 @@ public final class EdgeGrpcSession implements Closeable {
private void processEntityMessage(EdgeEvent edgeEvent, ActionType edgeEventAction) { private void processEntityMessage(EdgeEvent edgeEvent, ActionType edgeEventAction) {
UpdateMsgType msgType = getResponseMsgType(ActionType.valueOf(edgeEvent.getEdgeEventAction())); UpdateMsgType msgType = getResponseMsgType(ActionType.valueOf(edgeEvent.getEdgeEventAction()));
log.trace("Executing processEntityCRUDMessage, edgeEvent [{}], edgeEventAction [{}], msgType [{}]", edgeEvent, edgeEventAction, msgType); log.trace("Executing processEntityMessage, edgeEvent [{}], edgeEventAction [{}], msgType [{}]", edgeEvent, edgeEventAction, msgType);
switch (edgeEvent.getEdgeEventType()) { switch (edgeEvent.getEdgeEventType()) {
case EDGE: case EDGE:
// TODO: voba - add edge update logic // TODO: voba - add edge update logic
@ -571,13 +573,14 @@ public final class EdgeGrpcSession implements Closeable {
.build()); .build());
} }
} catch (Exception e) { } catch (Exception e) {
log.error("Can't process alarm CRUD msg [{}] [{}]", edgeEvent, msgType, e); log.error("Can't process alarm msg [{}] [{}]", edgeEvent, msgType, e);
} }
} }
private UpdateMsgType getResponseMsgType(ActionType actionType) { private UpdateMsgType getResponseMsgType(ActionType actionType) {
switch (actionType) { switch (actionType) {
case UPDATED: case UPDATED:
case CREDENTIALS_UPDATED:
return UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE; return UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE;
case ADDED: case ADDED:
case ASSIGNED_TO_EDGE: case ASSIGNED_TO_EDGE:

View File

@ -43,7 +43,8 @@ public enum ActionType {
LOGOUT(false), LOGOUT(false),
LOCKOUT(false), LOCKOUT(false),
ASSIGNED_TO_EDGE(false), // log edge name ASSIGNED_TO_EDGE(false), // log edge name
UNASSIGNED_FROM_EDGE(false); // log edge name UNASSIGNED_FROM_EDGE(false), // log edge name
CREDENTIALS_REQUEST(false); // request credentials from edge
private final boolean isRead; private final boolean isRead;