Commit febfc6443e1f652c04e79bd791a303d313de054d

Authored by Volodymyr Babak
1 parent 1bf4fb1a

Misc fixes

... ... @@ -235,6 +235,8 @@ public class AuthController extends BaseController {
235 235 }
236 236 }
237 237
  238 + sendNotificationMsgToEdgeService(user.getTenantId(), user.getId(), ActionType.CREDENTIALS_UPDATED);
  239 +
238 240 JwtToken accessToken = tokenFactory.createAccessJwtToken(securityUser);
239 241 JwtToken refreshToken = refreshTokenRepository.requestRefreshToken(securityUser);
240 242
... ...
... ... @@ -867,7 +867,7 @@ public final class EdgeGrpcSession implements Closeable {
867 867 }
868 868 if (uplinkMsg.getRelationUpdateMsgList() != null && !uplinkMsg.getRelationUpdateMsgList().isEmpty()) {
869 869 for (RelationUpdateMsg relationUpdateMsg: uplinkMsg.getRelationUpdateMsgList()) {
870   - onRelationUpdate(relationUpdateMsg);
  870 + result.add(onRelationUpdate(relationUpdateMsg));
871 871 }
872 872 }
873 873 if (uplinkMsg.getRuleChainMetadataRequestMsgList() != null && !uplinkMsg.getRuleChainMetadataRequestMsgList().isEmpty()) {
... ... @@ -1170,11 +1170,13 @@ public final class EdgeGrpcSession implements Closeable {
1170 1170 @Override
1171 1171 public void onSuccess(TbQueueMsgMetadata metadata) {
1172 1172 // TODO: voba - handle success
  1173 + log.debug("Successfully send ENTITY_CREATED EVENT to rule engine [{}]", device);
1173 1174 }
1174 1175
1175 1176 @Override
1176 1177 public void onFailure(Throwable t) {
1177 1178 // TODO: voba - handle failure
  1179 + log.debug("Failed to send ENTITY_CREATED EVENT to rule engine [{}]", device, t);
1178 1180 }
1179 1181 });
1180 1182 } catch (JsonProcessingException | IllegalArgumentException e) {
... ... @@ -1262,12 +1264,12 @@ public final class EdgeGrpcSession implements Closeable {
1262 1264 }
1263 1265 return Futures.immediateFuture(null);
1264 1266 } catch (Exception e) {
1265   - log.error("Error during finding existent alarm", e);
1266   - return Futures.immediateFailedFuture(new RuntimeException("Error during finding existent alarm", e));
  1267 + log.error("Failed to process alarm update msg [{}]", alarmUpdateMsg, e);
  1268 + return Futures.immediateFailedFuture(new RuntimeException("Failed to process alarm update msg", e));
1267 1269 }
1268 1270 }
1269 1271
1270   - private void onRelationUpdate(RelationUpdateMsg relationUpdateMsg) {
  1272 + private ListenableFuture<Void> onRelationUpdate(RelationUpdateMsg relationUpdateMsg) {
1271 1273 log.info("onRelationUpdate {}", relationUpdateMsg);
1272 1274 try {
1273 1275 EntityRelation entityRelation = new EntityRelation();
... ... @@ -1297,8 +1299,10 @@ public final class EdgeGrpcSession implements Closeable {
1297 1299 case UNRECOGNIZED:
1298 1300 log.error("Unsupported msg type");
1299 1301 }
  1302 + return Futures.immediateFuture(null);
1300 1303 } catch (Exception e) {
1301   - log.error("Error during relation update msg", e);
  1304 + log.error("Failed to process relation update msg [{}]", relationUpdateMsg, e);
  1305 + return Futures.immediateFailedFuture(new RuntimeException("Failed to process relation update msg", e));
1302 1306 }
1303 1307 }
1304 1308
... ...
... ... @@ -24,6 +24,8 @@ public final class EdgeUtils {
24 24
25 25 public static EdgeEventType getEdgeEventTypeByEntityType(EntityType entityType) {
26 26 switch (entityType) {
  27 + case EDGE:
  28 + return EdgeEventType.EDGE;
27 29 case DEVICE:
28 30 return EdgeEventType.DEVICE;
29 31 case ASSET:
... ...