Showing
1 changed file
with
21 additions
and
23 deletions
@@ -951,6 +951,7 @@ public final class EdgeGrpcSession implements Closeable { | @@ -951,6 +951,7 @@ public final class EdgeGrpcSession implements Closeable { | ||
951 | 951 | ||
952 | @Override | 952 | @Override |
953 | public void onFailure(Throwable t) { | 953 | public void onFailure(Throwable t) { |
954 | + log.error("Can't process post telemetry [{}]", msg, t); | ||
954 | futureToSet.setException(t); | 955 | futureToSet.setException(t); |
955 | } | 956 | } |
956 | }); | 957 | }); |
@@ -970,6 +971,7 @@ public final class EdgeGrpcSession implements Closeable { | @@ -970,6 +971,7 @@ public final class EdgeGrpcSession implements Closeable { | ||
970 | 971 | ||
971 | @Override | 972 | @Override |
972 | public void onFailure(Throwable t) { | 973 | public void onFailure(Throwable t) { |
974 | + log.error("Can't process post attributes [{}]", msg, t); | ||
973 | futureToSet.setException(t); | 975 | futureToSet.setException(t); |
974 | } | 976 | } |
975 | }); | 977 | }); |
@@ -978,31 +980,27 @@ public final class EdgeGrpcSession implements Closeable { | @@ -978,31 +980,27 @@ public final class EdgeGrpcSession implements Closeable { | ||
978 | 980 | ||
979 | private ListenableFuture<Void> processAttributeDeleteMsg(EntityId entityId, AttributeDeleteMsg attributeDeleteMsg, String entityType) { | 981 | private ListenableFuture<Void> processAttributeDeleteMsg(EntityId entityId, AttributeDeleteMsg attributeDeleteMsg, String entityType) { |
980 | SettableFuture<Void> futureToSet = SettableFuture.create(); | 982 | SettableFuture<Void> futureToSet = SettableFuture.create(); |
981 | - try { | ||
982 | - String scope = attributeDeleteMsg.getScope(); | ||
983 | - List<String> attributeNames = attributeDeleteMsg.getAttributeNamesList(); | ||
984 | - ctx.getAttributesService().removeAll(edge.getTenantId(), entityId, scope, attributeNames); | ||
985 | - if (EntityType.DEVICE.name().equals(entityType)) { | ||
986 | - Set<AttributeKey> attributeKeys = new HashSet<>(); | ||
987 | - for (String attributeName : attributeNames) { | ||
988 | - attributeKeys.add(new AttributeKey(scope, attributeName)); | 983 | + String scope = attributeDeleteMsg.getScope(); |
984 | + List<String> attributeNames = attributeDeleteMsg.getAttributeNamesList(); | ||
985 | + ctx.getAttributesService().removeAll(edge.getTenantId(), entityId, scope, attributeNames); | ||
986 | + if (EntityType.DEVICE.name().equals(entityType)) { | ||
987 | + Set<AttributeKey> attributeKeys = new HashSet<>(); | ||
988 | + for (String attributeName : attributeNames) { | ||
989 | + attributeKeys.add(new AttributeKey(scope, attributeName)); | ||
990 | + } | ||
991 | + ctx.getTbClusterService().pushMsgToCore(DeviceAttributesEventNotificationMsg.onDelete( | ||
992 | + edge.getTenantId(), (DeviceId) entityId, attributeKeys), new TbQueueCallback() { | ||
993 | + @Override | ||
994 | + public void onSuccess(TbQueueMsgMetadata metadata) { | ||
995 | + futureToSet.set(null); | ||
989 | } | 996 | } |
990 | - ctx.getTbClusterService().pushMsgToCore(DeviceAttributesEventNotificationMsg.onDelete( | ||
991 | - edge.getTenantId(), (DeviceId) entityId, attributeKeys), new TbQueueCallback() { | ||
992 | - @Override | ||
993 | - public void onSuccess(TbQueueMsgMetadata metadata) { | ||
994 | - futureToSet.set(null); | ||
995 | - } | ||
996 | 997 | ||
997 | - @Override | ||
998 | - public void onFailure(Throwable t) { | ||
999 | - futureToSet.setException(t); | ||
1000 | - } | ||
1001 | - }); | ||
1002 | - } | ||
1003 | - } catch (Exception e) { | ||
1004 | - log.error("Can't process attribute delete msg [{}]", attributeDeleteMsg, e); | ||
1005 | - return Futures.immediateFailedFuture(new RuntimeException("Can't process attribute delete msg " + attributeDeleteMsg, e)); | 998 | + @Override |
999 | + public void onFailure(Throwable t) { | ||
1000 | + log.error("Can't process attribute delete msg [{}]", attributeDeleteMsg, t); | ||
1001 | + futureToSet.setException(t); | ||
1002 | + } | ||
1003 | + }); | ||
1006 | } | 1004 | } |
1007 | return futureToSet; | 1005 | return futureToSet; |
1008 | } | 1006 | } |