|
|
|
@ -171,9 +171,14 @@ public class DefaultTelemetrySubscriptionService extends AbstractSubscriptionSer |
|
|
|
|
|
|
|
@Override |
|
|
|
public void saveAndNotify(TenantId tenantId, EntityId entityId, String scope, List<AttributeKvEntry> attributes, FutureCallback<Void> callback) { |
|
|
|
saveAndNotify(tenantId, entityId, scope, attributes, true, callback); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void saveAndNotify(TenantId tenantId, EntityId entityId, String scope, List<AttributeKvEntry> attributes, boolean notifyDevice, FutureCallback<Void> callback) { |
|
|
|
ListenableFuture<List<Void>> saveFuture = attrService.save(tenantId, entityId, scope, attributes); |
|
|
|
addMainCallback(saveFuture, callback); |
|
|
|
addWsCallback(saveFuture, success -> onAttributesUpdate(tenantId, entityId, scope, attributes)); |
|
|
|
addWsCallback(saveFuture, success -> onAttributesUpdate(tenantId, entityId, scope, attributes, notifyDevice)); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@ -236,11 +241,11 @@ public class DefaultTelemetrySubscriptionService extends AbstractSubscriptionSer |
|
|
|
, System.currentTimeMillis())), callback); |
|
|
|
} |
|
|
|
|
|
|
|
private void onAttributesUpdate(TenantId tenantId, EntityId entityId, String scope, List<AttributeKvEntry> attributes) { |
|
|
|
private void onAttributesUpdate(TenantId tenantId, EntityId entityId, String scope, List<AttributeKvEntry> attributes, boolean notifyDevice) { |
|
|
|
TopicPartitionInfo tpi = partitionService.resolve(ServiceType.TB_CORE, tenantId, entityId); |
|
|
|
if (currentPartitions.contains(tpi)) { |
|
|
|
if (subscriptionManagerService.isPresent()) { |
|
|
|
subscriptionManagerService.get().onAttributesUpdate(tenantId, entityId, scope, attributes, TbCallback.EMPTY); |
|
|
|
subscriptionManagerService.get().onAttributesUpdate(tenantId, entityId, scope, attributes, notifyDevice, TbCallback.EMPTY); |
|
|
|
} else { |
|
|
|
log.warn("Possible misconfiguration because subscriptionManagerService is null!"); |
|
|
|
} |
|
|
|
|