Skip to content

Serdes Utility

Serdes is a utility with the serializers and deserializers for many built-in types in Java and allows defining new ones.

import org.apache.kafka.common.serialization.Serdes

val longSerde = Serdes.Long
scala> :type longSerde

scala> :type longSerde.serializer

scala> :type longSerde.deserializer


Serdes defines a static public class WrapperSerde<T> that is a Serde from and to T values.

  • ShortSerde
  • BytesSerde
  • IntegerSerde
  • ListSerde
  • UUIDSerde
  • FloatSerde
  • FullTimeWindowedSerde (Kafka Streams)
  • VoidSerde
  • LongSerde
  • DoubleSerde
  • ByteArraySerde
  • TimeWindowedSerde (Kafka Streams)
  • SessionWindowedSerde (Kafka Streams)
  • ByteBufferSerde
  • StringSerde


Serde<T> serdeFrom(
  Class<T> type)
Serde<T> serdeFrom(
  Serializer<T> serializer,
  Deserializer<T> deserializer)

serdeFrom looks up the Serde for a given type (if supported) or creates a new one based on the given pair of Serializer and Deserializer.