use of org.thingsboard.server.gen.transport.TransportProtos.ToTransportMsg in project thingsboard by thingsboard.
the class DefaultTbCoreToTransportService method process.
@Override
public void process(String nodeId, ToTransportMsg msg, Runnable onSuccess, Consumer<Throwable> onFailure) {
if (nodeId == null || nodeId.isEmpty()) {
log.trace("process: skipping message without nodeId [{}], (ToTransportMsg) msg [{}]", nodeId, msg);
if (onSuccess != null) {
onSuccess.run();
}
return;
}
TopicPartitionInfo tpi = partitionService.getNotificationsTopic(ServiceType.TB_TRANSPORT, nodeId);
UUID sessionId = new UUID(msg.getSessionIdMSB(), msg.getSessionIdLSB());
log.trace("[{}][{}] Pushing session data to topic: {}", tpi.getFullTopicName(), sessionId, msg);
TbProtoQueueMsg<ToTransportMsg> queueMsg = new TbProtoQueueMsg<>(NULL_UUID, msg);
tbTransportProducer.send(tpi, queueMsg, new QueueCallbackAdaptor(onSuccess, onFailure));
}
use of org.thingsboard.server.gen.transport.TransportProtos.ToTransportMsg in project thingsboard by thingsboard.
the class DeviceActorMessageProcessor method sendToTransport.
private void sendToTransport(ToDeviceRpcRequestMsg rpcMsg, UUID sessionId, String nodeId) {
ToTransportMsg msg = ToTransportMsg.newBuilder().setSessionIdMSB(sessionId.getMostSignificantBits()).setSessionIdLSB(sessionId.getLeastSignificantBits()).setToDeviceRequest(rpcMsg).build();
systemContext.getTbCoreToTransportService().process(nodeId, msg);
}
use of org.thingsboard.server.gen.transport.TransportProtos.ToTransportMsg in project thingsboard by thingsboard.
the class DeviceActorMessageProcessor method sendToTransport.
private void sendToTransport(ToServerRpcResponseMsg rpcMsg, UUID sessionId, String nodeId) {
ToTransportMsg msg = ToTransportMsg.newBuilder().setSessionIdMSB(sessionId.getMostSignificantBits()).setSessionIdLSB(sessionId.getLeastSignificantBits()).setToServerResponse(rpcMsg).build();
systemContext.getTbCoreToTransportService().process(nodeId, msg);
}
use of org.thingsboard.server.gen.transport.TransportProtos.ToTransportMsg in project thingsboard by thingsboard.
the class DeviceActorMessageProcessor method sendToTransport.
private void sendToTransport(AttributeUpdateNotificationMsg notificationMsg, UUID sessionId, String nodeId) {
ToTransportMsg msg = ToTransportMsg.newBuilder().setSessionIdMSB(sessionId.getMostSignificantBits()).setSessionIdLSB(sessionId.getLeastSignificantBits()).setAttributeUpdateNotification(notificationMsg).build();
systemContext.getTbCoreToTransportService().process(nodeId, msg);
}
use of org.thingsboard.server.gen.transport.TransportProtos.ToTransportMsg in project thingsboard by thingsboard.
the class DefaultTbClusterService method onResourceDeleted.
@Override
public void onResourceDeleted(TbResource resource, TbQueueCallback callback) {
log.trace("[{}] Processing delete resource", resource);
TransportProtos.ResourceDeleteMsg resourceUpdateMsg = TransportProtos.ResourceDeleteMsg.newBuilder().setTenantIdMSB(resource.getTenantId().getId().getMostSignificantBits()).setTenantIdLSB(resource.getTenantId().getId().getLeastSignificantBits()).setResourceType(resource.getResourceType().name()).setResourceKey(resource.getResourceKey()).build();
ToTransportMsg transportMsg = ToTransportMsg.newBuilder().setResourceDeleteMsg(resourceUpdateMsg).build();
broadcast(transportMsg, callback);
}
Aggregations