Skip to main content
Avro is the most widely used format with the Schema Registry. It’s compact on the wire, has a well-specified resolution algorithm for reading data written under a different schema, and its compatibility rules are the most predictable of the three formats.

Configure the serializer

And the deserializer:
Add the dependency:
The Confluent artifacts come from Confluent’s Maven repository:

SpecificRecord or GenericRecord

Avro gives you two ways to represent a record in Java, and the choice affects how schema changes reach your code.

SpecificRecord

Generate a class from an .avsc file with the Avro Maven plugin, and work with typed getters and setters:
Use it when the schema is stable and you want compile-time safety. The trade-off is that a schema change means regenerating the class and redeploying—which is a feature, not a bug, if you want schema drift to surface at build time.

GenericRecord

Work with the schema at runtime, addressing fields by name:
Use it when you don’t know the schema at build time—routers, sinks, format converters, and any application that handles whatever arrives. The cost is no compile-time checking: a renamed field becomes a runtime null.
Most applications should use SpecificRecord. Reach for GenericRecord when the code is genuinely schema-agnostic, not merely when generating classes feels like a chore.

Compatibility rules

Avro compatibility follows the Avro schema resolution rules. The practical version: Defaults are what make evolution work. A field with no default gives a reader nothing to fall back on when the writer’s data omits it, so almost every safe addition is an addition with a default. To rename a field without breaking readers, keep the old name as an alias:
The default compatibility mode is BACKWARD. See Evolution and compatibility.

Logical types

Avro logical types—timestamp-millis, decimal, uuid, date—annotate a primitive with semantic meaning:
Compatibility is evaluated on the underlying primitive, so changing the logical type while keeping the primitive passes the check but may change how your application interprets the value. Treat a logical-type change as a breaking change even when the registry accepts it.

Schema references

Avro references a schema by its fully qualified record name. See Schema references.

Normalization

?normalize=true performs real normalization for Avro, so schemas differing only in field ordering or whitespace resolve to the same schema ID.

Next steps

Protobuf

Field numbers, imports, and null handling.

JSON Schema

Open content models and per-construct compatibility.