liveBook · Manning

Forward compatibility

As explained in Kafka for Architects

Forward compatibility is a schema compatibility policy in which consumers using an older schema can read messages produced with the new schema.

Forward compatibility lets producers adopt a new event schema first while older consumers continue processing the resulting messages. Older consumers ignore unfamiliar fields and use defaults for missing optional fields, allowing versions to coexist during gradual migration. section 6.2.5 section 6.4.4

Apply the policy through schema rules rather than consumer-specific conversion code:

  • Add fields that older consumers can ignore. section 6.4.4
  • Delete optional fields when older consumers can supply their default values. section 6.4.4
  • Reject changes such as renaming fields or altering their data types when they could break deserialization. section 6.2.5
  • Validate schema versions in the Schema Registry to prevent incompatible messages from reaching consumers. section 6.2.5

Adding address while retiring score

A producer moves from V1 to V2 by removing the optional score attribute and adding address. An older V1 consumer ignores address and assigns the default value to score, so the producer can be upgraded first. section 6.4.4

Figure 6.15 An example of forward compatibility. The old consumer must understand the new version of the schema.
A black background with white rectangles and white rectangles

Description automatically generated

Use the forward-compatibility diagram to trace the producer-first rollout and the old consumer's interpretation of the new schema. section 6.4.4

How Kafka for Architects covers it

How deep it goes
Defines the rollout order, allowed field changes, defaults, ignored fields, and schema validation, but defers fuller compatibility treatment.
Examples
Uses a V1-to-V2 event that removes optional score, adds mandatory address, and relies on ignored fields and defaults.
What it assumes
Assumes familiarity with producers, consumers, event schemas, schema versions, and default field values.
What you can do after
Operate schema evolution by upgrading producers first and validating forward-compatible versions before older consumers process them.
How it connects
Connects schema evolution with event schemas, Schema Registry, backward compatibility, deserialization, and phased deployments.

Also explained in

Compare how 5 books explain forward compatibility →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kafka for Architects. The section links point to the parts of the book it draws on.