Documentation

Guides for schemreg: Kafka wire formats byte by byte, producer configuration, codecs, caching, backends, resilience, security, and performance.

Task-oriented guides. For the per-item API reference — every type, method, and error variant — see docs.rs/schemreg.

Start with the quick start if you want working code, or the wire-format guide if you are debugging an interop failure and need to know exactly which bytes go on the topic.

Quick start

Install schemreg, frame a Kafka record with its schema ID, and decode it again — with a Confluent Schema Registry, AWS Glue, or no registry at all.

Wire formats

Exactly which bytes go on a Kafka topic: Confluent v0 and v1 prefixes, schema IDs in Kafka headers, the Protobuf message-index array, and the AWS Glue 18-byte header.

Producer configuration

SchemaResolution and Framing: whether a producer may register schemas, which wire format it emits, and whether the identifier travels in the payload prefix or a Kafka header.

Codecs

Avro, JSON Schema, and Protobuf codecs for schemreg: serialisation and framing in one step, reader-schema evolution, cross-subject references, and message-type verification.

Using it with a Kafka client

Wire schemreg into a Kafka client — shown with krafka: encode before the send, decode after the poll, schema IDs in record headers, and error mapping at the boundary.

Caching

How schemreg caches schemas: immutable-identifier caching, request coalescing, cancellation safety, invalidation races, and bounded memory on every message-driven path.

Choosing a backend

Confluent Schema Registry, Karapace, Redpanda, Apicurio Registry v3, and AWS Glue — what each one supports, what the native Apicurio client costs, and why Azure and Buf are out of scope.

Resilience

Retry policy and error classification in schemreg: jittered exponential back-off, Retry-After handling, and a uniform is_retryable() contract across Confluent, Apicurio, and AWS Glue.

Security

Threat model and controls: credential handling, path-traversal defence, TLS posture, denial-of-service bounds, schema-reference traversal, and supply-chain gates.

Performance

Measured numbers for wire-format decoding, cache hits, Protobuf index handling, and request coalescing — plus how to size the caches.

Testing strategy

The test layers behind schemreg, what each one is for, and what it would take to fool it — including the cross-language conformance harness and real TLS handshakes.

Migrating to 0.7

Upgrade path from schemreg 0.6.x to 0.7.0: decoders read schema-id headers first, TLS moves to rustls on aws-lc-rs with the OS trust store, and the MSRV becomes 1.94.1.

Migrating to 0.6

Upgrade path from schemreg 0.5.x to 0.6.0: the Avro decoder gains a builder, reader schemas resolve their own references, and dependency order stops mattering.

Migrating to 0.5

Upgrade path from schemreg 0.4.x to 0.5.0: SchemaKey decoding, optional schema IDs, producer resolution policy, and the behavioural changes without a compile error.

Migrating to 0.4

Upgrade path from schemreg 0.3.x to 0.4.0, including the critical Protobuf message-index framing fix.