|
|
|
@ -24,12 +24,15 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.context.annotation.Lazy; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.util.StringUtils; |
|
|
|
import org.thingsboard.rule.engine.api.msg.DeviceAttributesEventNotificationMsg; |
|
|
|
import org.thingsboard.rule.engine.api.util.DonAsynchron; |
|
|
|
import org.thingsboard.server.actors.service.ActorService; |
|
|
|
import org.thingsboard.server.common.data.DataConstants; |
|
|
|
import org.thingsboard.server.common.data.EntityType; |
|
|
|
import org.thingsboard.server.common.data.id.DeviceId; |
|
|
|
import org.thingsboard.server.common.data.id.EntityId; |
|
|
|
import org.thingsboard.server.common.data.id.EntityIdFactory; |
|
|
|
import org.thingsboard.server.common.data.id.TenantId; |
|
|
|
import org.thingsboard.server.common.data.kv.AttributeKvEntry; |
|
|
|
import org.thingsboard.server.common.data.kv.BaseAttributeKvEntry; |
|
|
|
import org.thingsboard.server.common.data.kv.BaseTsKvQuery; |
|
|
|
@ -42,6 +45,7 @@ import org.thingsboard.server.common.data.kv.LongDataEntry; |
|
|
|
import org.thingsboard.server.common.data.kv.StringDataEntry; |
|
|
|
import org.thingsboard.server.common.data.kv.TsKvEntry; |
|
|
|
import org.thingsboard.server.common.data.kv.TsKvQuery; |
|
|
|
import org.thingsboard.server.common.msg.cluster.SendToClusterMsg; |
|
|
|
import org.thingsboard.server.common.msg.cluster.ServerAddress; |
|
|
|
import org.thingsboard.server.dao.attributes.AttributesService; |
|
|
|
import org.thingsboard.server.dao.timeseries.TimeseriesService; |
|
|
|
@ -101,6 +105,10 @@ public class DefaultTelemetrySubscriptionService implements TelemetrySubscriptio |
|
|
|
@Lazy |
|
|
|
private DeviceStateService stateService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Lazy |
|
|
|
private ActorService actorService; |
|
|
|
|
|
|
|
private ExecutorService tsCallBackExecutor; |
|
|
|
private ExecutorService wsCallBackExecutor; |
|
|
|
|
|
|
|
@ -203,6 +211,13 @@ public class DefaultTelemetrySubscriptionService implements TelemetrySubscriptio |
|
|
|
, System.currentTimeMillis())), callback); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onSharedAttributesUpdate(TenantId tenantId, DeviceId deviceId, Set<AttributeKvEntry> attributes) { |
|
|
|
DeviceAttributesEventNotificationMsg notificationMsg = DeviceAttributesEventNotificationMsg.onUpdate(tenantId, |
|
|
|
deviceId, DataConstants.SHARED_SCOPE, new ArrayList<>(attributes)); |
|
|
|
actorService.onMsg(new SendToClusterMsg(deviceId, notificationMsg)); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void onNewRemoteSubscription(ServerAddress serverAddress, byte[] data) { |
|
|
|
ClusterAPIProtos.SubscriptionProto proto; |
|
|
|
|