Back to blog

Blog

Event-Driven Architecture Diagram: 4 Kafka Examples

How to draw an event-driven architecture diagram with Kafka: 4 copyable examples, the topic, key and consumer group details to show, and a review checklist.

event-driven architecture diagramUpdated 11/15/2026Shafi Khan

Event-Driven Architecture Diagram: 4 Kafka Examples

An event-driven architecture diagram shows who publishes each event, where it lands, who consumes it, and what happens when consumption fails. With Kafka, that means drawing topics (not just "the bus"), the key that controls ordering, the consumer groups that read each topic, and the path events take out of your database. Get those details on the canvas and the diagram answers the questions incident reviews always ask: what's ordered, what's replayable, and where do bad records go?

Below: what to draw, four copyable event-driven architecture diagram examples with Kafka, the configs that back them up, and a review checklist.

Why an event-driven architecture diagram needs more than arrows

Here's the problem with most event-driven diagrams: one fat box labelled "Kafka", twelve arrows going in, twelve coming out, zero information. It looks like architecture. It's actually a mood board.

Kafka's own docs explain why that doesn't cut it. Producers and consumers are "fully decoupled and agnostic of each other", topics are "always multi-producer and multi-subscriber", and, unlike traditional messaging systems, "events are not deleted after consumption" (Apache Kafka introduction). Retention is a per-topic setting.

Translation for your diagram:

  1. Coupling moves into the topic. Services don't know about each other, so the topic and its schema are the contract. Draw them.
  2. Fan-out is invisible from the producer side. The only place you can see who depends on an event is the diagram (or the broker).
  3. Replay is a feature. Since events stick around for the retention period, a new consumer can read history. That's a design decision worth annotating.

→ Skip the blank canvas: open an event-driven starting point from the Pattern Library

How to draw an event-driven architecture diagram: the Kafka legend

Use this element set. Every row exists because someone, somewhere, got paged without it.

ElementWhat to drawWhy reviewers care
ProducerService box, named by business capabilityWho emits the event and owns its schema
TopicOne box per topic, e.g. orders.order-placedTopics are the contract, not the cluster
KeyLabel on the topic: key: orderIdSame key goes to the same partition, which is your ordering guarantee
Partitions and RF6 partitions, RF 3 on the topicPartitions cap consumer parallelism; RF shows durability
Retention or compactionretain 7d or compactedSays whether replay or "latest value per key" is possible
Consumer groupEdge label with the group id, e.g. group: billingThe unit of fan-out and of scaling
ConnectorsKafka Connect source and sink boxesSeparate deployables with their own failure modes
Stream processorsKafka Streams or similar apps as their own boxesThey consume and produce, so they're on both sides
Failure pathRetry and dead-letter topicsProves poison messages don't block a partition forever
Sync callsSolid arrows, kept visually distinct from event edgesMixing them hides real coupling

Two details from the Kafka docs are worth having in your head while you draw:

  • Ordering is per partition, not per topic. Events with the same key land in the same partition, and every consumer reads a partition's events in the same order. If your consumers need order per customer, the key is customerId. Write it on the diagram.
  • Each partition is read by exactly one consumer in a group at a time (Kafka design docs). With classic consumer groups, partition count is the ceiling on parallelism inside one group: a seventh consumer on a six-partition topic just sits there. (Kafka's newer share groups relax this, but most systems in production still use classic groups.)

Want the request/response side of the story too? Pair this with a sequence diagram for the synchronous edges. The sequence diagram examples post shows the format.

→ Describe your producers, topics and consumers in plain English and let Architect AI draft the topology

Example 1: pub/sub fan-out with consumer groups

The baseline event-driven architecture diagram example with Kafka. Orders publishes one event; three teams react to it independently.

[orders-service] --produce (key: orderId)--> [topic: orders.order-placed]
                                              6 partitions, RF 3, retain 7d
                                                     |
                 +-----------------------------------+------------------------+
                 | group: notifications              | group: billing         | group: analytics
                 v                                   v                        v
     [notifications-service x2]          [billing-service x6]       [analytics-loader x1]

The topic, created to match the diagram:

kafka-topics.sh --bootstrap-server localhost:9092 \
  --create --topic orders.order-placed \
  --partitions 6 --replication-factor 3 \
  --config retention.ms=604800000

604800000 ms is seven days. A replication factor of 3 is what Kafka's docs call "a common production setting", meaning three copies of your data.

How to read this diagram, and why each label matters:

  • Three groups, three full copies of the stream. Billing being slow doesn't slow notifications. Each group tracks its own offsets.
  • Billing can scale to six instances, not sixty. The partition count says so. If billing needs more, that's a repartitioning conversation, and it changes key-to-partition mapping, so plan it.
  • Analytics runs one instance. Fine, as long as its lag is monitored. Put the lag alert on the diagram as a note.

This is the Kafka consumer group diagram most teams need on day one. It also answers the classic review question, "if we change the event schema, who breaks?" Answer: everyone on the right-hand side.

→ Check whether partitions and consumers will hold at peak with Scalability Analyzer

Example 2: the transactional outbox pattern diagram

The bug this one prevents is subtle and very common. A service writes to its database, then publishes to Kafka. If the write succeeds and the publish fails, downstream never hears about it. If it's the other way round, you've announced something that didn't happen.

AWS Prescriptive Guidance calls this the dual-write problem and documents the fix: the transactional outbox pattern. Write the business row and an outbox row in the same local transaction, then let a separate relay forward committed outbox rows to the broker.

+------------------- orders-service boundary -------------------+
|                                                               |
|  [orders-api] --single transaction--> [Postgres: orders]      |
|                                       [Postgres: outbox]      |
+---------------------------------------------|-----------------+
                                              | CDC / polling relay
                                              v
                              [Kafka Connect: outbox source connector]
                                              |
                                              v
                              [topic: orders.order-placed]  key: orderId
                                              |
                                              v  group: billing
                                   [billing-service (idempotent)]

The transaction, in plain SQL:

BEGIN;

INSERT INTO orders (id, customer_id, total_cents, status)
VALUES ('ord_123', 'cus_42', 4999, 'PLACED');

INSERT INTO outbox (id, aggregate_type, aggregate_id, event_type, payload, created_at)
VALUES (
  gen_random_uuid(),
  'order',
  'ord_123',
  'OrderPlaced',
  '{"orderId":"ord_123","customerId":"cus_42","totalCents":4999}'::jsonb,
  now()
);

COMMIT;

gen_random_uuid() is built into PostgreSQL 13 and later.

Diagram rules for the outbox:

  • Draw the outbox table inside the service's database boundary. It's part of the service, not shared infrastructure.
  • Draw the relay as its own box. Whether it's a polling job or change data capture through Kafka Connect, it can lag or fail independently.
  • Mark the consumer idempotent. The AWS guidance is explicit that the relay "might send out duplicate messages or events", so consumers should track what they've processed. Kafka itself is at-least-once by default per its design docs, so this applies end to end.

For the bigger consistency picture across services (sagas, compensation, read models), see the data consistency explainer.

→ Map the outbox, relay and consumers as a step-by-step sequence in Flow IQ

Example 3: retry and dead-letter topics

One malformed event. One consumer that throws on it. Same offset retried forever, partition stuck, lag climbing, someone's phone going off. Classic.

The fix is to give failures somewhere to go, and to put that somewhere on the diagram.

[topic: payments.charge-requested]
            | group: payments
            v
   [payments-worker] --fails, attempt < 3--> [topic: payments.charge-requested.retry]
            |                                         | group: payments-retry
            |                                         v
            |                               [payments-retry-worker] --still failing-->
            |                                                                     |
            +--------------- poison / schema error ----------------+              |
                                                                   v              v
                                                  [topic: payments.charge-requested.dlt]
                                                                   |
                                                         alert + manual replay

Two kinds of failure path exist here, and the diagram should say which is which:

  • Application consumers: retry and dead-letter topics are a pattern your code (or your client framework) implements. Kafka doesn't reroute failed records for a plain consumer. Draw the topics and name the component that writes to them.
  • Kafka Connect sink connectors: these have dead-letter handling built in. The Kafka Connect user guide documents errors.tolerance (default none, fail on first error) and errors.deadletterqueue.topic.name for errors in converters, transforms or the sink itself.

A sink connector config that matches the diagram:

{
  "name": "orders-to-warehouse",
  "config": {
    "connector.class": "<your sink connector class>",
    "topics": "orders.order-placed",
    "tasks.max": "3",
    "errors.tolerance": "all",
    "errors.deadletterqueue.topic.name": "orders.order-placed.dlt",
    "errors.deadletterqueue.context.headers.enable": "true"
  }
}

Annotate the DLT with who gets alerted and how replay works. A dead-letter topic nobody watches is just a slower way to lose data.

→ Find the abuse and failure paths around your topics with Threat Analyzer

Example 4: stream processing with a compacted topic

Now the system needs a live "current order status" view, joined from orders and payments. A stream processor consumes both topics and writes the result to a compacted topic, which downstream services or a sink connector read.

[topic: orders.order-placed]   key: orderId --+
                                              |  group: order-status-app
[topic: payments.charge-settled] key: orderId -+------> [Kafka Streams: order-status-app]
                                                                  |
                                                                  v
                                       [topic: orders.order-status]  compacted, key: orderId
                                                                  |
                              +-----------------------------------+------------------+
                              | group: status-api                                     | sink connector
                              v                                                       v
                     [order-status-api]                                    [search index]

Create the compacted topic:

kafka-topics.sh --bootstrap-server localhost:9092 \
  --create --topic orders.order-status \
  --partitions 6 --replication-factor 3 \
  --config cleanup.policy=compact

What to call out:

  • Both input topics share the same key. Joins in stream processing generally need co-partitioned inputs (same key, same partition count). If the keys differ, the diagram should show a repartition step.
  • Compaction keeps at least the last value per key (Kafka design docs). Label the topic compacted so nobody assumes they can replay every status change from it.
  • The stream app is a producer and a consumer. Draw it as one box with edges on both sides, and give it a group id.

→ Learn how queuing pressure and consumer lag show up as systems scale

Turn real infrastructure into the diagram (instead of guessing)

Drawing from memory is how diagrams drift. Pull the truth from the cluster and the code:

  1. List topics and configs. kafka-topics.sh --bootstrap-server <broker> --describe gives partitions, replication factor and config overrides per topic.
  2. List consumer groups. kafka-consumer-groups.sh --bootstrap-server <broker> --list, then --describe --group <id> for lag and members.
  3. Grep producers. Search your services for topic names and producer configs. Anything producing that isn't on the diagram is a finding.
  4. Check local stacks. If your team runs Kafka in Docker Compose for development, drop the file into the free Docker Compose Diagrammer to turn it into a visual dependency map.
  5. Draw sync calls separately. The microservices architecture diagram guide covers how to keep REST calls and events visually distinct.

If part of your event flow runs on AWS managed services instead (SQS, SNS, EventBridge), the serverless architecture diagram examples cover those edges and limits.

→ Run your Docker Compose file through the free Docker Compose Diagrammer

Event-driven architecture diagram review checklist

Run this before the design review:

  • Every topic is its own box, with a name that says what happened (order-placed, not events)
  • Each topic shows its key, partition count, replication factor and retention or compaction
  • Consumers that need ordering read a topic keyed by the entity they order on
  • Every consumer edge is labelled with its consumer group id
  • No group expects more parallelism than the topic has partitions
  • Database writes that emit events use an outbox or CDC, not a dual write
  • Every consumer that can see duplicates is marked idempotent
  • Retry and dead-letter topics exist for consumers that can fail per record, with an owner and alert
  • Kafka Connect connectors appear as their own components with DLQ settings noted
  • Stream processors appear on both sides (consume and produce) with input keys aligned
  • Each topic has an owning team and a schema contract
  • Synchronous calls are drawn differently from event edges
  • The diagram matches the broker: topics and groups were checked against the cluster, not memory

Want this as a reusable review template? The free Architecture Review Checklist Builder turns lists like this into a checklist your team can run every time.

→ Build a reusable event-driven review checklist with the free Architecture Review Checklist Builder

Key takeaways

  • An event-driven architecture diagram is about topics, keys and consumer groups, not one box labelled "Kafka".
  • Ordering is per partition, and the key picks the partition. Write the key on every topic.
  • Partitions cap parallelism within a classic consumer group. Show the count.
  • Use the transactional outbox (or CDC) to avoid dual writes, and make consumers idempotent.
  • Give failures somewhere to go: retry and dead-letter topics, with an owner who watches them.
  • Draw the diagram from the broker and the code, then keep it in sync.

→ Start free and draw your first event-driven architecture on Architecto

FAQ

What should an event-driven architecture diagram include?

Every producer, every topic (with its key and partition count), every consumer group, and the direction of each edge. Add the things that decide behaviour in production: which key preserves ordering, how many partitions cap consumer parallelism, where failed records go (retry or dead-letter topic), how events get from the database to the broker (outbox or change data capture), and which team owns each topic.

How do you draw a Kafka architecture diagram?

Put producers on the left, the Kafka cluster in the middle with each topic drawn as its own box, and consumer groups on the right. Label each topic with its key, partition count and replication factor, and label each outgoing edge with the consumer group name rather than the service name. Draw Kafka Connect connectors and stream processors as separate boxes, because they are separate deployable components.

Should Kafka consumer groups be shown on an architecture diagram?

Yes. In Kafka, each partition is consumed by exactly one consumer within a consumer group at a time, and each group gets its own copy of the stream. The consumer group is therefore the unit of fan-out and of scaling, so a diagram that only shows service names hides how many independent readers a topic has and how far each one can scale.

What is the transactional outbox pattern in an event-driven diagram?

It is how a service updates its database and publishes an event without a dual write. The service writes the business row and an outbox row in the same local transaction, then a relay or change data capture process forwards committed outbox rows to the broker. On the diagram, draw the outbox table inside the service's database boundary and the relay as its own component between the database and the topic.

→ Go deeper on async messaging trade-offs in the async messaging explainer

Draw the event flow you actually run

Event-driven systems are great at decoupling services and weirdly good at hiding dependencies. Every new consumer is one config change and zero lines of diagram, until the schema change that breaks three teams at once.

The fix isn't a prettier bus icon. It's a diagram that names every topic, key and consumer group, shows where failures land, and gets checked against the broker. Start from a proven event-driven pattern, describe the changes in plain English, and run scalability and threat reviews on the same canvas.

→ Start free on Architecto and open an event-driven pattern from the Pattern Library

FAQ

Questions readers ask before they act on this page.

What should an event-driven architecture diagram include?

Every producer, every topic (with its key and partition count), every consumer group, and the direction of each edge. Add the things that decide behaviour in production: which key preserves ordering, how many partitions cap consumer parallelism, where failed records go (retry or dead-letter topic), how events get from the database to the broker (outbox or change data capture), and which team owns each topic.

How do you draw a Kafka architecture diagram?

Put producers on the left, the Kafka cluster in the middle with each topic drawn as its own box, and consumer groups on the right. Label each topic with its key, partition count and replication factor, and label each outgoing edge with the consumer group name rather than the service name. Draw Kafka Connect connectors and stream processors as separate boxes, because they are separate deployable components.

Should Kafka consumer groups be shown on an architecture diagram?

Yes. In Kafka, each partition is consumed by exactly one consumer within a consumer group at a time, and each group gets its own copy of the stream. The consumer group is therefore the unit of fan-out and of scaling, so a diagram that only shows service names hides how many independent readers a topic has and how far each one can scale.

What is the transactional outbox pattern in an event-driven diagram?

It is how a service updates its database and publishes an event without a dual write. The service writes the business row and an outbox row in the same local transaction, then a relay or change data capture process forwards committed outbox rows to the broker. On the diagram, draw the outbox table inside the service's database boundary and the relay as its own component between the database and the topic.

Related reading

Keep moving through the architecture workflow.

Free tool

Docker Compose Diagrammer

Quickly explain local platform topologies, integration stacks, and migration candidates by turning compose files into a visual dependency map.

docker compose visualizercompose file diagramcontainer topology mapper

Free tool

Architecture Review Checklist Builder

Build repeatable review packets for cloud architectures, migrations, data systems, and internal platforms without relying on static spreadsheets.

system design review checklistarchitecture governance checklistdesign review template

Free tool

STRIDE Threat Checklist

Walk through spoofing, tampering, repudiation, information disclosure, denial of service, and elevation risks using a deterministic system model.

threat modeling checkliststride templatesecurity review checklist

Guide

What async messaging means in Microservices and Distributed Systems

What async messaging means in Microservices and Distributed Systems with technical review guidance, practical artifacts, and a workflow path into diagrams, documentation, and architecture governance.

microservices architectureasync messagingdistributed systems design

Guide

What data consistency means in Microservices and Distributed Systems

What data consistency means in Microservices and Distributed Systems with technical review guidance, practical artifacts, and a workflow path into diagrams, documentation, and architecture governance.

microservices architecturedata consistencydistributed systems design

Comparison

Architecto vs Structurizr

Architecto vs Structurizr with a workflow-first comparison across diagrams, architecture review, technical documentation, and code-adjacent implementation evidence.

structurizr alternativearchitecto vs structurizrbrand comparison
Event-Driven Architecture Diagram: 4 Kafka Examples | Architecto