T
- Type to be serialized from.public interface Serializer<T> extends Closeable
Implement ClusterResourceListener
to receive cluster metadata once it's available. Please see the class documentation for ClusterResourceListener for more information.
Modifier and Type | Method and Description |
---|---|
default void |
close()
Close this serializer.
|
default void |
configure(Map<String,?> configs,
boolean isKey)
Configure this class.
|
default byte[] |
serialize(String topic,
Headers headers,
T data)
Convert
data into a byte array. |
byte[] |
serialize(String topic,
T data)
Convert
data into a byte array. |
default void configure(Map<String,?> configs, boolean isKey)
configs
- configs in key/value pairsisKey
- whether is for key or valuebyte[] serialize(String topic, T data)
data
into a byte array.topic
- topic associated with datadata
- typed datadefault byte[] serialize(String topic, Headers headers, T data)
data
into a byte array.topic
- topic associated with dataheaders
- headers associated with the recorddata
- typed datadefault void close()
This method must be idempotent as it may be called multiple times.
close
in interface AutoCloseable
close
in interface Closeable