You need to update the schema of the messages being produced to a Kafka topic without disrupting the existing consumers. How do you handle schema evolution in Kafka?

Handling Kafka schema evolution means changing the structure of the records written to a topic over time without breaking consumers that haven't upgraded yet, typically managed through a schema registry and backward-compatible changes.

Key Points

Example

Adding an optional "discountCode" field with a default value to an "OrderCreated" schema lets old consumers ignore the new field entirely while new consumers can read it, so both producer and consumer versions can coexist during a rolling deployment.

// Avro schema, version 2: the new field is optional with a default,
// so consumers on version 1 keep working (backward compatible)
{
  "type": "record",
  "name": "OrderCreated",
  "namespace": "com.shop.events",
  "fields": [
    {"name": "orderId",      "type": "string"},
    {"name": "amount",       "type": "double"},
    {"name": "discountCode", "type": ["null", "string"], "default": null}
  ]
}

# Schema Registry rejects incompatible changes when compatibility is enforced
curl -X PUT http://schema-registry:8081/config/orders-value \
  -H "Content-Type: application/vnd.schemaregistry.v1+json" \
  -d '{"compatibility": "BACKWARD"}'

Interview Tip

A concise interview answer is

I'd manage schema evolution through a Schema Registry with backward compatibility enforced, so new fields are added as optional with sensible defaults, letting old consumers keep working against the new schema while producers and consumers are upgraded independently and gradually.

Last updated: 1 November 2026

Previous question: Your application requires exactly-once processing semantics. How do you configure Kafka to achieve this?

Next question: Your application requires high availability and fault tolerance for the Kafka cluster. How do you configure Kafka to meet these requirements?

More Kafka (Optional) interview questions

All Kafka (Optional) questions