Skip to content
Kafka Is Fun

BeginnerCore Concepts

What serialization formats are commonly used with Kafka?

Reference answer

Kafka itself only stores bytes: the key and value of a record are byte arrays, and the client converts objects to and from bytes with a Serializer (producer: key.serializer, value.serializer) and a Deserializer (consumer). The kafka-clients library ships serializers for String (UTF-8 by default), Integer, Long, Short, Float, Double, Boolean, UUID, ByteArray, ByteBuffer, Bytes and List. Other formats such as JSON or Avro need a serializer that you write or that a library provides; Kafka Streams docs, for example, show a basic JSON serde built with Serdes.serdeFrom, and the Streams Serdes cover the same basic types. Kafka Connect makes the format a configuration choice through key.converter and value.converter, and its documentation names JSON and Avro as common formats. Which format to use is a design choice about schema enforcement, size and compatibility rather than something the broker enforces.

Expected key concepts: String, JSON, Avro, bytes, Serializer, Deserializer, key.serializer, value.serializer, Serdes, key.converter, value.converter

How did that feel?

Your own verdict, not the score. It shows up next to this question in the list, so you can come back to the shaky ones.