public class CloudEventSerializer extends Object implements Serializer<io.cloudevents.CloudEvent>
Serializer for CloudEvent.
To configure the encoding to use when serializing the event, you can use the ENCODING_CONFIG configuration key,
which accepts both a String or a variant of the enum Encoding. If you configure the Encoding as Encoding.STRUCTURED,
you MUST configure the EventFormat to use with EVENT_FORMAT_CONFIG, specifying a String
corresponding to the content type of the event format or specifying an instance of EventFormat.
| Modifier and Type | Field and Description |
|---|---|
static String |
ENCODING_CONFIG
The configuration key for the
Encoding to use when serializing the event. |
static String |
EVENT_FORMAT_CONFIG
The configuration key for the
EventFormat to use when serializing the event in structured mode. |
| Constructor and Description |
|---|
CloudEventSerializer() |
| Modifier and Type | Method and Description |
|---|---|
void |
configure(Map<String,?> configs,
boolean isKey) |
byte[] |
serialize(String topic,
io.cloudevents.CloudEvent data) |
byte[] |
serialize(String topic,
Headers headers,
io.cloudevents.CloudEvent data) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclosepublic static final String ENCODING_CONFIG
Encoding to use when serializing the event.public static final String EVENT_FORMAT_CONFIG
EventFormat to use when serializing the event in structured mode.public void configure(Map<String,?> configs, boolean isKey)
configure in interface Serializer<io.cloudevents.CloudEvent>public byte[] serialize(String topic, io.cloudevents.CloudEvent data)
serialize in interface Serializer<io.cloudevents.CloudEvent>public byte[] serialize(String topic, Headers headers, io.cloudevents.CloudEvent data)
serialize in interface Serializer<io.cloudevents.CloudEvent>Copyright © 2021. All rights reserved.