Docs & Code Guide

A living diagram from Kafka topics: list topics, read the schema registry, and map who produces and consumes what

Every Kafka team eventually asks the same question in an incident channel: who consumes this topic? The cluster can answer most of it. Topics are listable, the schema registry names every contract, and consumer group offsets are a precise record of who reads what. The map of your streaming platform is assembleable from those sources, and worth drawing once as a diagram that regenerates when the topology changes.

8 min readFor teams running Kafka who keep asking who consumes this topic

See it as a diagram

Everything below, as a diagram you can edit. Describe yours and see it in seconds.

251/20003 credits left
Try:

No account needed · Editable canvas, not a picture

The inventory: topics and subjects

Start with what exists. kafka-topics.sh --list enumerates every topic on the cluster, and the schema registry's subjects endpoint enumerates every registered contract; under the default TopicNameStrategy a subject named orders.created-value binds a schema to the orders.created topic. Between the two you have the nodes of the diagram and, where schemas exist, what flows through each one.

The subjects list is also a quality signal in itself: topics with no registered subject are the ones carrying unversioned payloads, exactly the edges where a data contract is missing.

kafka-topics.sh --bootstrap-server broker:9092 --list

# Every reader, per group: which topics, which partitions, what lag
kafka-consumer-groups.sh --bootstrap-server broker:9092 \
  --describe --all-groups

# Every registered contract
curl -s http://schema-registry:8081/subjects

Consumers are observable, producers mostly are not

Here is the asymmetry that shapes the whole exercise. Consumers announce themselves: committed offsets mean kafka-consumer-groups.sh --describe --all-groups lists every group and exactly which topics and partitions it reads, with lag as a bonus. The consume edges of your diagram come straight from the cluster, no code reading required.

Producers register nothing. A service that writes to a topic leaves no standing record in the cluster, so the produce edges need indirect sources: ACLs are the best one, since kafka-acls.sh --list shows which principals hold WRITE on which topics in a locked-down cluster. Failing that, it is client configs and code search. A diagram tool cannot fix this asymmetry; it can only be honest about which edges are observed and which are declared.

Naming conventions become zones, internal topics become noise

If your topics follow a domain.entity.event convention, orders.created, payments.captured, the diagram's grouping is already decided: one zone per domain, topics inside it, services on the edges. This is where a curated diagram beats any auto-layout of the full topic list.

The full list also needs filtering. A real cluster carries internal topics, __consumer_offsets, connect-configs and friends, plus the -changelog and -repartition topics Kafka Streams creates per application. They are implementation detail, and a wiki diagram that includes them buries the fifty topics that matter under two hundred that do not.

Topics as code: regenerate in the same PR

If topics are managed declaratively, a Terraform provider, a GitOps topology file, then topic changes arrive as merges, and the diagram loop hooks there: when CI applies the topology change, one added step has an agent connected to Datadef's MCP server (registry io.datadef/mcp) update the diagram, new topics into their domain zones, consumer edges refreshed from the cluster describe output. The agent connection needs an API key, available on paid plans; the MCP diagram server guide covers setup.

Datadef does not watch the cluster or the repo; the regeneration is the one command you add. For clusters managed by hand, a scheduled job that re-reads topics, subjects, and groups weekly is the honest fallback. Either way the wiki embed refreshes itself within minutes of a diagram update, and the first version of the diagram is quickest through the Kafka streaming architecture generator.

What the cluster cannot see

Consumer group output describes active and recently active groups: committed offsets expire after the broker's offsets.retention.minutes, seven days by default, so a consumer that has been down for weeks quietly vanishes from the map. Treat the describe output as "who reads now", not "who has ever read".

Produce edges built from ACLs are permissions, not activity: WRITE granted is not WRITE used. And the embed that keeps the wiki current requires the Datadef project to be shared public, which for a diagram naming internal services and topics deserves a deliberate yes. The wider pipeline documentation practice around this diagram is covered in keep pipeline docs in sync.

Label the edge source

Consume edges come from offsets, observed. Produce edges come from ACLs or code, declared. A trustworthy Kafka diagram annotates which is which.

FAQ

How do I map Kafka producers and consumers?

Consumers come from the cluster: kafka-consumer-groups.sh --describe --all-groups lists every group with the exact topics and partitions it reads. Producers leave no standing record, so produce edges come from ACLs (kafka-acls.sh --list shows WRITE grants per topic), client configuration, or code search. Topics and schema registry subjects provide the node inventory.

Why do producers not show up anywhere in Kafka?

Kafka brokers do not maintain a registry of producers; writing to a topic requires no registration and leaves no durable record beyond the messages themselves. Consumer groups, by contrast, commit offsets that persist. That is why consumer edges are observable from the cluster while producer edges must be declared from ACLs or code.

How do I keep a Kafka topology diagram up to date?

If topics are managed as code, add one step to the CI job that applies topology changes: an MCP-connected agent re-reads topics, subjects, and consumer groups and updates the diagram. Nothing watches the cluster automatically, so for hand-managed clusters a scheduled re-read is the honest fallback. Embedded copies of the diagram refresh within minutes of an update.

Should internal topics appear in the diagram?

No. __consumer_offsets, Connect's internal topics, and the -changelog and -repartition topics created by Kafka Streams are implementation detail. Filtering them keeps the wiki view at the level of business topics, where domain grouping and producer-consumer edges mean something to a reader.

Can consumer group data go stale?

Yes. Committed offsets expire after offsets.retention.minutes, seven days by default, so a consumer that has been offline longer disappears from describe output. A topology diagram built from group offsets shows current readers, and should be captioned as such rather than as a permanent record.