Video in progress
Dozens of teams use one Kafka platform. What rules do you set for topics, event contracts and ownership?
Every topic needs a clear owner (the producing team), a naming convention, a mandatory schema in the schema registry and a compatibility mode. Topic creation and ACLs go through code (GitOps), not by hand; otherwise after a year nobody knows what is for what.
📖 Answer
The most common situation I've seen: 2,000 topics, half of them with no known owner, names like test-orders-2 and orders_new_final, and no schemas at all.
The rules I introduce:
Naming. <domain>.<context>.<event-type>.v<major>, for example payments.card.authorized.v1. A domain-based ACL prefix then becomes easy: only the payments team writes to payments.*.
Ownership. Only one service (or one team) writes to a topic. The topic is its public API. Everyone else only reads. If two teams write to the same topic, schema changes happen without agreement.
Contract. A schema is mandatory for every topic, auto.register.schemas=false, compatibility FULL_TRANSITIVE or at least BACKWARD_TRANSITIVE. Schemas live in a central repo or in the producer's repo, and CI checks compatibility.
Event design. A mandatory envelope: eventId, occurredAt, source, type, traceId. The key is the domain entity ID.
Self-service, but through code. Topics, partition counts, retention and ACLs are in YAML, via PR, approved by the platform team. Terraform or the Strimzi KafkaTopic CRD.
apiVersion: kafka.strimzi.io/v1beta2
kind: KafkaTopic
metadata:
name: payments.card.authorized.v1
labels: { strimzi.io/cluster: main, owner: payments-team }
spec:
partitions: 24
replicas: 3
config: { retention.ms: 604800000, min.insync.replicas: 2 }
A catalog. Which topic is written by whom, who reads it (collected automatically from consumer groups), and a link to the schema. Without it, teams create the same event twice.
To keep all of this from turning into bureaucracy, the "good way" has to be the easiest way: templates, a generator, creating a topic with one command.
Sign up to mark studied questions and save your progress.