From 6c8defe68e19e365be5506610e0b7f64901f95a3 Mon Sep 17 00:00:00 2001 From: Yevhenii Date: Wed, 4 Dec 2024 14:42:38 +0200 Subject: [PATCH] Fixed Proto --- .../service/cloud/KafkaCloudEventMigrationService.java | 2 +- .../server/service/cloud/KafkaCloudEventService.java | 4 ++-- .../java/org/thingsboard/server/common/util/ProtoUtils.java | 6 +++--- common/proto/src/main/proto/queue.proto | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/application/src/main/java/org/thingsboard/server/service/cloud/KafkaCloudEventMigrationService.java b/application/src/main/java/org/thingsboard/server/service/cloud/KafkaCloudEventMigrationService.java index e3f4748c5d..25638c224a 100644 --- a/application/src/main/java/org/thingsboard/server/service/cloud/KafkaCloudEventMigrationService.java +++ b/application/src/main/java/org/thingsboard/server/service/cloud/KafkaCloudEventMigrationService.java @@ -225,7 +225,7 @@ private void sendCloudEventToTopic(CloudEvent cloudEvent, boolean isTS) { TbQueueProducer> producer = chooseProducer(isTS); TopicPartitionInfo tpi = new TopicPartitionInfo(producer.getDefaultTopic(), cloudEvent.getTenantId(), 1, true); - TransportProtos.EdgeEventMsgProto cloudEventMsgProto = ProtoUtils.toProto(cloudEvent); + TransportProtos.CloudEventMsgProto cloudEventMsgProto = ProtoUtils.toProto(cloudEvent); TransportProtos.ToCloudEventMsg toCloudEventMsg = TransportProtos.ToCloudEventMsg.newBuilder().setCloudEventMsg(cloudEventMsgProto).build(); UUID entityId = cloudEvent.getEntityId() == null ? UUID.fromString(cloudEvent.getEntityBody().get("from").get("id").asText()) : cloudEvent.getEntityId(); diff --git a/application/src/main/java/org/thingsboard/server/service/cloud/KafkaCloudEventService.java b/application/src/main/java/org/thingsboard/server/service/cloud/KafkaCloudEventService.java index 9399a4dc22..492bdcbdd2 100644 --- a/application/src/main/java/org/thingsboard/server/service/cloud/KafkaCloudEventService.java +++ b/application/src/main/java/org/thingsboard/server/service/cloud/KafkaCloudEventService.java @@ -46,7 +46,7 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; -import static org.thingsboard.server.gen.transport.TransportProtos.EdgeEventMsgProto; +import static org.thingsboard.server.gen.transport.TransportProtos.CloudEventMsgProto; import static org.thingsboard.server.gen.transport.TransportProtos.ToCloudEventMsg; @Service @@ -124,7 +124,7 @@ private void sendCloudEventToTopic(CloudEvent cloudEvent, boolean isTS) { TbQueueProducer> producer = chooseProducer(isTS); TopicPartitionInfo tpi = new TopicPartitionInfo(producer.getDefaultTopic(), cloudEvent.getTenantId(), 1, true); - EdgeEventMsgProto cloudEventMsgProto = ProtoUtils.toProto(cloudEvent); + CloudEventMsgProto cloudEventMsgProto = ProtoUtils.toProto(cloudEvent); ToCloudEventMsg toCloudEventMsg = ToCloudEventMsg.newBuilder().setCloudEventMsg(cloudEventMsgProto).build(); UUID entityId = cloudEvent.getEntityId() == null ? UUID.fromString(cloudEvent.getEntityBody().get("from").get("id").asText()) : cloudEvent.getEntityId(); diff --git a/common/proto/src/main/java/org/thingsboard/server/common/util/ProtoUtils.java b/common/proto/src/main/java/org/thingsboard/server/common/util/ProtoUtils.java index 9d2dd4c59e..5854663f82 100644 --- a/common/proto/src/main/java/org/thingsboard/server/common/util/ProtoUtils.java +++ b/common/proto/src/main/java/org/thingsboard/server/common/util/ProtoUtils.java @@ -227,8 +227,8 @@ public static EdgeEvent fromProto(TransportProtos.EdgeEventMsgProto proto) { return edgeEvent; } - public static TransportProtos.EdgeEventMsgProto toProto(CloudEvent cloudEvent) { - TransportProtos.EdgeEventMsgProto.Builder builder = TransportProtos.EdgeEventMsgProto.newBuilder(); + public static TransportProtos.CloudEventMsgProto toProto(CloudEvent cloudEvent) { + TransportProtos.CloudEventMsgProto.Builder builder = TransportProtos.CloudEventMsgProto.newBuilder(); builder.setTenantIdMSB(cloudEvent.getTenantId().getId().getMostSignificantBits()); builder.setTenantIdLSB(cloudEvent.getTenantId().getId().getLeastSignificantBits()); @@ -246,7 +246,7 @@ public static TransportProtos.EdgeEventMsgProto toProto(CloudEvent cloudEvent) { return builder.build(); } - public static CloudEvent fromProto(TransportProtos.EdgeEventMsgProto proto) { + public static CloudEvent fromProto(TransportProtos.CloudEventMsgProto proto) { CloudEvent cloudEvent = new CloudEvent(); TenantId tenantId = new TenantId(new UUID(proto.getTenantIdMSB(), proto.getTenantIdLSB())); cloudEvent.setTenantId(tenantId); diff --git a/common/proto/src/main/proto/queue.proto b/common/proto/src/main/proto/queue.proto index 7568f61f0e..4b99fa3017 100644 --- a/common/proto/src/main/proto/queue.proto +++ b/common/proto/src/main/proto/queue.proto @@ -1156,7 +1156,7 @@ message EdgeNotificationMsgProto { int64 originatorEdgeIdLSB = 14; } -message EdgeEventMsgProto { +message CloudEventMsgProto { int64 tenantIdMSB = 1; int64 tenantIdLSB = 2; string entityType = 3; @@ -1564,7 +1564,7 @@ message ToEdgeMsg { } message ToCloudEventMsg{ - EdgeEventMsgProto cloudEventMsg = 1; + CloudEventMsgProto cloudEventMsg = 1; } message ToEdgeNotificationMsg {