Search in sources :

Example 11 with ToTransportMsg

use of org.thingsboard.server.gen.transport.TransportProtos.ToTransportMsg in project thingsboard by thingsboard.

the class DefaultTbClusterService method onResourceChange.

@Override
public void onResourceChange(TbResource resource, TbQueueCallback callback) {
    TenantId tenantId = resource.getTenantId();
    log.trace("[{}][{}][{}] Processing change resource", tenantId, resource.getResourceType(), resource.getResourceKey());
    TransportProtos.ResourceUpdateMsg resourceUpdateMsg = TransportProtos.ResourceUpdateMsg.newBuilder().setTenantIdMSB(tenantId.getId().getMostSignificantBits()).setTenantIdLSB(tenantId.getId().getLeastSignificantBits()).setResourceType(resource.getResourceType().name()).setResourceKey(resource.getResourceKey()).build();
    ToTransportMsg transportMsg = ToTransportMsg.newBuilder().setResourceUpdateMsg(resourceUpdateMsg).build();
    broadcast(transportMsg, callback);
}
Also used : TenantId(org.thingsboard.server.common.data.id.TenantId) ToTransportMsg(org.thingsboard.server.gen.transport.TransportProtos.ToTransportMsg) TransportProtos(org.thingsboard.server.gen.transport.TransportProtos)

Example 12 with ToTransportMsg

use of org.thingsboard.server.gen.transport.TransportProtos.ToTransportMsg in project thingsboard by thingsboard.

the class DefaultTbClusterService method broadcastEntityDeleteToTransport.

private void broadcastEntityDeleteToTransport(TenantId tenantId, EntityId entityId, String name, TbQueueCallback callback) {
    log.trace("[{}][{}][{}] Processing [{}] delete event", tenantId, entityId.getEntityType(), entityId.getId(), name);
    TransportProtos.EntityDeleteMsg entityDeleteMsg = TransportProtos.EntityDeleteMsg.newBuilder().setEntityType(entityId.getEntityType().name()).setEntityIdMSB(entityId.getId().getMostSignificantBits()).setEntityIdLSB(entityId.getId().getLeastSignificantBits()).build();
    ToTransportMsg transportMsg = ToTransportMsg.newBuilder().setEntityDeleteMsg(entityDeleteMsg).build();
    broadcast(transportMsg, callback);
}
Also used : ToTransportMsg(org.thingsboard.server.gen.transport.TransportProtos.ToTransportMsg) TransportProtos(org.thingsboard.server.gen.transport.TransportProtos)

Aggregations

ToTransportMsg (org.thingsboard.server.gen.transport.TransportProtos.ToTransportMsg)12 TransportProtos (org.thingsboard.server.gen.transport.TransportProtos)5 UUID (java.util.UUID)2 TenantId (org.thingsboard.server.common.data.id.TenantId)2 SessionCloseNotificationProto (org.thingsboard.server.gen.transport.TransportProtos.SessionCloseNotificationProto)2 ToTransportUpdateCredentialsProto (org.thingsboard.server.gen.transport.TransportProtos.ToTransportUpdateCredentialsProto)2 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 FutureCallback (com.google.common.util.concurrent.FutureCallback)1 Futures (com.google.common.util.concurrent.Futures)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 MoreExecutors (com.google.common.util.concurrent.MoreExecutors)1 ByteString (com.google.protobuf.ByteString)1 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collections (java.util.Collections)1 ConcurrentModificationException (java.util.ConcurrentModificationException)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1