Commit 4cf29e2d89a674b8412685612c8722c411c221ac

Authored by Volodymyr Babak
1 parent a5d75e38

Added support for dashboard telemetry and attributes update

@@ -248,7 +248,7 @@ public final class EdgeGrpcSession implements Closeable { @@ -248,7 +248,7 @@ public final class EdgeGrpcSession implements Closeable {
248 } else { 248 } else {
249 return 0L; 249 return 0L;
250 } 250 }
251 - }, MoreExecutors.directExecutor()); 251 + }, ctx.getDbCallbackExecutor());
252 } 252 }
253 253
254 private void updateQueueStartTs(Long newStartTs) { 254 private void updateQueueStartTs(Long newStartTs) {
@@ -270,7 +270,9 @@ public final class EdgeGrpcSession implements Closeable { @@ -270,7 +270,9 @@ public final class EdgeGrpcSession implements Closeable {
270 case ENTITY_VIEW: 270 case ENTITY_VIEW:
271 entityId = new EntityViewId(edgeEvent.getEntityId()); 271 entityId = new EntityViewId(edgeEvent.getEntityId());
272 break; 272 break;
273 - 273 + case DASHBOARD:
  274 + entityId = new DashboardId(edgeEvent.getEntityId());
  275 + break;
274 } 276 }
275 if (entityId != null) { 277 if (entityId != null) {
276 log.debug("Sending telemetry data msg, entityId [{}], body [{}]", edgeEvent.getEntityId(), edgeEvent.getEntityBody()); 278 log.debug("Sending telemetry data msg, entityId [{}], body [{}]", edgeEvent.getEntityId(), edgeEvent.getEntityBody());
@@ -290,7 +292,7 @@ public final class EdgeGrpcSession implements Closeable { @@ -290,7 +292,7 @@ public final class EdgeGrpcSession implements Closeable {
290 292
291 private void processEntityMessage(EdgeEvent edgeEvent, ActionType edgeEventAction) { 293 private void processEntityMessage(EdgeEvent edgeEvent, ActionType edgeEventAction) {
292 UpdateMsgType msgType = getResponseMsgType(ActionType.valueOf(edgeEvent.getEdgeEventAction())); 294 UpdateMsgType msgType = getResponseMsgType(ActionType.valueOf(edgeEvent.getEdgeEventAction()));
293 - log.trace("Executing processEntityCRUDMessage, edgeEvent [{}], edgeEventAction [{}], msgType [{}]", edgeEvent, edgeEventAction, msgType); 295 + log.trace("Executing processEntityMessage, edgeEvent [{}], edgeEventAction [{}], msgType [{}]", edgeEvent, edgeEventAction, msgType);
294 switch (edgeEvent.getEdgeEventType()) { 296 switch (edgeEvent.getEdgeEventType()) {
295 case EDGE: 297 case EDGE:
296 // TODO: voba - add edge update logic 298 // TODO: voba - add edge update logic
@@ -571,13 +573,14 @@ public final class EdgeGrpcSession implements Closeable { @@ -571,13 +573,14 @@ public final class EdgeGrpcSession implements Closeable {
571 .build()); 573 .build());
572 } 574 }
573 } catch (Exception e) { 575 } catch (Exception e) {
574 - log.error("Can't process alarm CRUD msg [{}] [{}]", edgeEvent, msgType, e); 576 + log.error("Can't process alarm msg [{}] [{}]", edgeEvent, msgType, e);
575 } 577 }
576 } 578 }
577 579
578 private UpdateMsgType getResponseMsgType(ActionType actionType) { 580 private UpdateMsgType getResponseMsgType(ActionType actionType) {
579 switch (actionType) { 581 switch (actionType) {
580 case UPDATED: 582 case UPDATED:
  583 + case CREDENTIALS_UPDATED:
581 return UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE; 584 return UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE;
582 case ADDED: 585 case ADDED:
583 case ASSIGNED_TO_EDGE: 586 case ASSIGNED_TO_EDGE:
@@ -43,7 +43,8 @@ public enum ActionType { @@ -43,7 +43,8 @@ public enum ActionType {
43 LOGOUT(false), 43 LOGOUT(false),
44 LOCKOUT(false), 44 LOCKOUT(false),
45 ASSIGNED_TO_EDGE(false), // log edge name 45 ASSIGNED_TO_EDGE(false), // log edge name
46 - UNASSIGNED_FROM_EDGE(false); // log edge name 46 + UNASSIGNED_FROM_EDGE(false), // log edge name
  47 + CREDENTIALS_REQUEST(false); // request credentials from edge
47 48
48 private final boolean isRead; 49 private final boolean isRead;
49 50