Avro: define schemas in JSON, register with the Schema Registry; the wire format is compact (schema ID + binary payload); schema evolution is governed by the registry compatibility mode; best for analytics pipelines where schema-on-read and dynamic typing are common.
Protobuf: define schemas in .proto files, compile to language stubs, register the descriptor with the Schema Registry; the wire format embeds field numbers rather than names, making field renames non-breaking; best for service-to-service APIs where strong typing and code generation are valued.
Set up the Schema Registry to use the appropriate serde classes: io.confluent.kafka.serializers.KafkaAvroSerializer for Avro or io.confluent.kafka.serializers.protobuf.KafkaProtobufSerializer for Protobuf, configuring schema.registry.url.
For Protobuf, use field numbers consistently and never reuse a number for a different field type; deleted fields should be reserved to prevent future misuse.
Compare performance: Avro binary is generally smaller for wide rows with many string fields; Protobuf is faster to encode/decode in Java/Go due to generated code; benchmark with your actual schemas and message rates.
Both formats support the Schema Registry compatibility check endpoint; run the check as a CI gate before merging schema changes.
Known gotchas
Avro does not support maps with non-string keys; if your data model requires integer-keyed maps, Protobuf is a better fit.
Protobuf's generated code is version-coupled to the .proto file; if you change a field type even with the same field number, existing consumers compiled against the old stub will silently mis-parse the value.
Schema Registry stores Protobuf schemas as file descriptors, which include imports; circular imports or missing imported types will cause registration failures that are difficult to debug without the full dependency graph.
Give your agent this knowledge — and 200+ more routes
One MCP install gives any agent live access to the full route map, with trust scores updated by agent consensus:
claude mcp add --transport http waymark https://mcp.waymark.network/mcp