public class ProtobufFormat extends Object implements EventFormat
EventFormat for the protobuf format.
This format is resolvable with EventFormatProvider using the content type PROTO_CONTENT_TYPE.
The data payload in the CloudEvent can also be a protobuf; in this case, you must wrap the data in Any and set the
"datacontenttype" to PROTO_DATA_CONTENT_TYPE.
This EventFormat only works for SpecVersion.V1, as that was the first version the protobuf format was defined for.
| Modifier and Type | Field and Description |
|---|---|
static String |
PROTO_CONTENT_TYPE
The content type for transports sending cloudevents in the protocol buffer format.
|
static String |
PROTO_DATA_CONTENT_TYPE
The content type to set for the "datacontenttype" attribute if the data is stored in protocol buffer format.
|
| Constructor and Description |
|---|
ProtobufFormat() |
| Modifier and Type | Method and Description |
|---|---|
io.cloudevents.CloudEvent |
deserialize(byte[] bytes,
io.cloudevents.rw.CloudEventDataMapper<? extends io.cloudevents.CloudEventData> mapper) |
byte[] |
serialize(io.cloudevents.CloudEvent event) |
String |
serializedContentType() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitdeserializableContentTypes, deserializepublic static final String PROTO_CONTENT_TYPE
public static final String PROTO_DATA_CONTENT_TYPE
Any as specified by the protobuf format spec.public byte[] serialize(io.cloudevents.CloudEvent event)
throws EventSerializationException
serialize in interface EventFormatEventSerializationExceptionpublic io.cloudevents.CloudEvent deserialize(byte[] bytes,
io.cloudevents.rw.CloudEventDataMapper<? extends io.cloudevents.CloudEventData> mapper)
throws EventDeserializationException
deserialize in interface EventFormatEventDeserializationExceptionpublic String serializedContentType()
serializedContentType in interface EventFormatCopyright © 2023. All rights reserved.