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 248 } else {
249 249 return 0L;
250 250 }
251   - }, MoreExecutors.directExecutor());
  251 + }, ctx.getDbCallbackExecutor());
252 252 }
253 253
254 254 private void updateQueueStartTs(Long newStartTs) {
... ... @@ -270,7 +270,9 @@ public final class EdgeGrpcSession implements Closeable {
270 270 case ENTITY_VIEW:
271 271 entityId = new EntityViewId(edgeEvent.getEntityId());
272 272 break;
273   -
  273 + case DASHBOARD:
  274 + entityId = new DashboardId(edgeEvent.getEntityId());
  275 + break;
274 276 }
275 277 if (entityId != null) {
276 278 log.debug("Sending telemetry data msg, entityId [{}], body [{}]", edgeEvent.getEntityId(), edgeEvent.getEntityBody());
... ... @@ -290,7 +292,7 @@ public final class EdgeGrpcSession implements Closeable {
290 292
291 293 private void processEntityMessage(EdgeEvent edgeEvent, ActionType edgeEventAction) {
292 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 296 switch (edgeEvent.getEdgeEventType()) {
295 297 case EDGE:
296 298 // TODO: voba - add edge update logic
... ... @@ -571,13 +573,14 @@ public final class EdgeGrpcSession implements Closeable {
571 573 .build());
572 574 }
573 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 580 private UpdateMsgType getResponseMsgType(ActionType actionType) {
579 581 switch (actionType) {
580 582 case UPDATED:
  583 + case CREDENTIALS_UPDATED:
581 584 return UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE;
582 585 case ADDED:
583 586 case ASSIGNED_TO_EDGE:
... ...
... ... @@ -43,7 +43,8 @@ public enum ActionType {
43 43 LOGOUT(false),
44 44 LOCKOUT(false),
45 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 49 private final boolean isRead;
49 50
... ...