We use the io.cloudevents:cloudevents-protobuf:4.0.1 lib to serialize and deserialize CloudEvents as protobuf messages. Unfortunately, there is no direct access to the ProtoSerializer and ProtoDeserializer classes. For our use case it would be very helpful if we could convert a io.cloudevents.CloudEvent into a io.cloudevents.v1.proto.CloudEvent protobuf message. Which is basically what the toProto method in ProtoSerializer does.
class ProtoSerializer { // <--- Can we make this class public?
public static CloudEvent toProto(io.cloudevents.CloudEvent ce) throws InvalidProtocolBufferException {
// ...
}
// ...
}
Unfortunately, this method is not accessible to consuming methods as the class is package-local, which does not allow us to call it from outside the io.cloudevents.protobuf package.
Currently, we can only use the ProtobufFormat to convert a CloudEvent to a byte[] which we can then decode as io.cloudevents.v1.proto.CloudEvent. This involves an unnecessary extra conversion step.
io.cloudevents.v1.proto.CloudEvent.parseFrom(new ProtobufFormat().serialize((io.cloudevents.CloudEvent) cloudEvent))
For symmetry reasons ProtoDeserializer should likely also be made public.
We use the
io.cloudevents:cloudevents-protobuf:4.0.1lib to serialize and deserialize CloudEvents as protobuf messages. Unfortunately, there is no direct access to theProtoSerializerandProtoDeserializerclasses. For our use case it would be very helpful if we could convert aio.cloudevents.CloudEventinto aio.cloudevents.v1.proto.CloudEventprotobuf message. Which is basically what thetoProtomethod inProtoSerializerdoes.Unfortunately, this method is not accessible to consuming methods as the class is package-local, which does not allow us to call it from outside the
io.cloudevents.protobufpackage.Currently, we can only use the
ProtobufFormatto convert aCloudEventto abyte[]which we can then decode asio.cloudevents.v1.proto.CloudEvent. This involves an unnecessary extra conversion step.For symmetry reasons
ProtoDeserializershould likely also be made public.