Commit 82bc7203efb58536deff1d515fb291d170a8338b

Authored by Viacheslav Klimov
Committed by Andrew Shvayka
1 parent 4b0cf383

Notify all core services when device is updated

@@ -283,10 +283,12 @@ public class DefaultTbClusterService implements TbClusterService { @@ -283,10 +283,12 @@ public class DefaultTbClusterService implements TbClusterService {
283 byte[] msgBytes = encodingService.encode(msg); 283 byte[] msgBytes = encodingService.encode(msg);
284 TbQueueProducer<TbProtoQueueMsg<ToRuleEngineNotificationMsg>> toRuleEngineProducer = producerProvider.getRuleEngineNotificationsMsgProducer(); 284 TbQueueProducer<TbProtoQueueMsg<ToRuleEngineNotificationMsg>> toRuleEngineProducer = producerProvider.getRuleEngineNotificationsMsgProducer();
285 Set<String> tbRuleEngineServices = new HashSet<>(partitionService.getAllServiceIds(ServiceType.TB_RULE_ENGINE)); 285 Set<String> tbRuleEngineServices = new HashSet<>(partitionService.getAllServiceIds(ServiceType.TB_RULE_ENGINE));
286 - if (msg.getEntityId().getEntityType().equals(EntityType.TENANT)  
287 - || msg.getEntityId().getEntityType().equals(EntityType.TENANT_PROFILE)  
288 - || msg.getEntityId().getEntityType().equals(EntityType.DEVICE_PROFILE)  
289 - || msg.getEntityId().getEntityType().equals(EntityType.API_USAGE_STATE)) { 286 + EntityType entityType = msg.getEntityId().getEntityType();
  287 + if (entityType.equals(EntityType.TENANT)
  288 + || entityType.equals(EntityType.TENANT_PROFILE)
  289 + || entityType.equals(EntityType.DEVICE_PROFILE)
  290 + || entityType.equals(EntityType.API_USAGE_STATE)
  291 + || (entityType.equals(EntityType.DEVICE) && msg.getEvent() == ComponentLifecycleEvent.UPDATED)) {
290 TbQueueProducer<TbProtoQueueMsg<ToCoreNotificationMsg>> toCoreNfProducer = producerProvider.getTbCoreNotificationsMsgProducer(); 292 TbQueueProducer<TbProtoQueueMsg<ToCoreNotificationMsg>> toCoreNfProducer = producerProvider.getTbCoreNotificationsMsgProducer();
291 Set<String> tbCoreServices = partitionService.getAllServiceIds(ServiceType.TB_CORE); 293 Set<String> tbCoreServices = partitionService.getAllServiceIds(ServiceType.TB_CORE);
292 for (String serviceId : tbCoreServices) { 294 for (String serviceId : tbCoreServices) {