Accepted
2024-09-15
Following the adoption of event-driven architecture (ADR-001), we must establish a governance model for the events flowing between services. As FizzBuzz Enterprise Edition scales to handle enterprise workloads, the contracts between producers and consumers become critical infrastructure.
Without formal schema governance, we risk:
- Schema Drift: Services evolving message formats independently, causing runtime deserialization failures
- Implicit Contracts: Event structures defined only in code, requiring source diving to understand
- Breaking Changes: No mechanism to detect incompatible changes before deployment
- Onboarding Friction: New engineers must reverse-engineer event formats from multiple codebases
Industry best practices mandate schema registry adoption for any production Kafka deployment. Per the Platform Engineering Standards (PES-2024), all event-driven systems must have documented, versioned schemas.
We will implement a formal Schema Registry using Apache Avro schemas from day one. Schemas will be registered with the Redpanda Schema Registry (bundled with our Kafka-compatible streaming platform).
-
Schema Definitions: All event schemas will be defined as Avro
.avscfiles in/schemas/avro/ -
Schema Registration: Schemas will be registered with the Redpanda Schema Registry:
- Local:
http://localhost:18081 - Production: Managed Redpanda Cloud endpoint
- Local:
-
Compatibility Mode: BACKWARD compatibility will be enforced, allowing:
- New optional fields with defaults
- Field deprecation (with default values)
But preventing:
- Required field removal
- Type changes
- Field renaming
-
CI Validation: All PRs modifying schemas will:
- Validate Avro syntax
- Check compatibility against the registry
| Topic | Schema | Description |
|---|---|---|
| numbers-topic | NumberSubmitted | Entry point: number submitted for processing |
| fizz-topic | FizzResult | Divisibility-by-3 determination with LLM metadata |
| buzz-topic | BuzzResult | Divisibility-by-5 determination with LLM metadata |
| fizzbuzz-topic | FizzBuzzResult | Aggregated final classification |
- Contract Clarity: Event structures are explicitly documented and versioned from project inception
- Evolution Safety: Incompatible changes are caught in CI before deployment
- Discoverability: Schema Registry UI provides self-service documentation
- Cross-Team Coordination: Schema change process formalizes producer-consumer communication
- Compliance Ready: Meets PES-2024 requirements for event governance
- Initial Overhead: Schemas must be defined before services can produce events
- Build Complexity: Services must maintain type definitions matching Avro schemas
- Learning Curve: Team members must learn Avro schema syntax
- Serialization Format: Initial implementation uses JSON serialization; Avro binary encoding available for future bandwidth optimization (~40% reduction)
Rejected: Less mature tooling for Kafka integration. Avro is the de facto standard for Kafka schema management with native Schema Registry support.
Rejected: Would require additional infrastructure (protoc compilation) and doesn't integrate as seamlessly with Confluent/Redpanda Schema Registry. Avro's self-describing format better supports our polyglot environment (Go + TypeScript).
Rejected: Violates PES-2024 standards and creates unacceptable operational risk as the platform scales.
- ADR-001: Event-Driven Architecture
- Redpanda Schema Registry Documentation
- Avro Specification 1.11.0
- PES-2024: Platform Engineering Standards