Skip to content

Commit

Permalink
Fixed Proto
Browse files Browse the repository at this point in the history
  • Loading branch information
jekka001 committed Dec 4, 2024
1 parent 69f1530 commit 6c8defe
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private void sendCloudEventToTopic(CloudEvent cloudEvent, boolean isTS) {
TbQueueProducer<TbProtoQueueMsg<TransportProtos.ToCloudEventMsg>> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -124,7 +124,7 @@ private void sendCloudEventToTopic(CloudEvent cloudEvent, boolean isTS) {
TbQueueProducer<TbProtoQueueMsg<ToCloudEventMsg>> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions common/proto/src/main/proto/queue.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ message EdgeNotificationMsgProto {
int64 originatorEdgeIdLSB = 14;
}

message EdgeEventMsgProto {
message CloudEventMsgProto {
int64 tenantIdMSB = 1;
int64 tenantIdLSB = 2;
string entityType = 3;
Expand Down Expand Up @@ -1564,7 +1564,7 @@ message ToEdgeMsg {
}

message ToCloudEventMsg{
EdgeEventMsgProto cloudEventMsg = 1;
CloudEventMsgProto cloudEventMsg = 1;
}

message ToEdgeNotificationMsg {
Expand Down

0 comments on commit 6c8defe

Please sign in to comment.