kafka-proto-serde / com.fleshgrinder.kotlin.kafka / NativeSerde

NativeSerde

class NativeSerde<T> : BaseSerde<T>

NativeSerde decorates Kafka Serdes and allows direct access to its Serializer and Deserializer functions.

Parameters

T - is the concrete type the decorated Serde is able to serialize and deserialize.

inner - Serde to decorate with the BaseSerde interface.

See Also

serde

Constructors

<init>

NativeSerde(inner: Serde<T>)

NativeSerde decorates Kafka Serdes and allows direct access to its Serializer and Deserializer functions.

Functions

doDeserialize

fun doDeserialize(topic: String, data: ByteArray): T

Extending classes must implement this function to convert the ByteArray back to its original type T.

doSerialize

fun doSerialize(topic: String, data: T): ByteArray

Extending classes must implement this method to convert data of type T to a ByteArray.

Inherited Functions

close

open fun close(): Unit

Close this Serde/Serializer/Deserializer and frees any currently held resources. This method must be idempotent because it might be called multiple times.

configure

open fun configure(config: Map<String, *>, isKey: Boolean): Unit

Configure this object, which will configure the underlying Serializer and Deserializer.

deserialize

fun deserialize(topic: String, data: ByteArray?): T?

Convert data to T

deserializer

fun deserializer(): Deserializer<T>

Get the underlying Deserializer

serialize

fun serialize(topic: String, data: T?): ByteArray?

Convert data to a ByteArray

serializer

fun serializer(): Serializer<T>

Get the underlying Serializer