Integration / Apache Kafka Interview questions
What is a serializer in Kafka producer configuration?
A serializer converts a Java object (a String, a custom class, an Avro/Protobuf record) into the raw bytes Kafka actually stores and transmits, since Kafka itself is agnostic to message format and just deals in byte arrays. A producer configures separate serializers for the record's key and value, since they're often different types.
key.serializer=org.apache.kafka.common.serialization.StringSerializer value.serializer=org.apache.kafka.common.serialization.StringSerializer
Kafka ships built-in serializers for common primitives (StringSerializer, IntegerSerializer, ByteArraySerializer), and structured-format libraries (Avro, Protobuf, JSON Schema) provide their own, often paired with a schema registry so the exact schema used doesn't need to be repeated in every single message. On the consumer side, a matching deserializer reverses the process, converting the raw bytes back into a usable object — a mismatch between a producer's serializer and a consumer's deserializer is one of the most common sources of runtime errors in a Kafka application.
More Related questions...