Skip to content

Event-driven systems

An event-driven diagram answers who hands a message off, which pipe carries it, and who sees a later view of state. Keep those three facts distinct. Put the timeline on a sequence and the failure policy on its own diagram.

Operator Meaning Head
-> Synchronous call. The sender waits. Filled
=> Asynchronous handoff. The sender delivers a message and does not wait. Open, dashed on a flow
~> Eventual observation. A reader sees an earlier write later. No message is sent on this edge. Open, dotted
-x Failure or rejection. Filled, danger color

Publishing and enqueueing are both =>. The past-tense name on the label, such as OrderPlaced, is the message. An event or command node is that message. The channel is the pipe.

~> is the read model, the replica, or the log tail catching up. It is a later view of state.

On a sequence the same heads apply. A handoff stays a solid open arrow, because the dashed shaft is reserved for a reply (-->). An eventual signal stays dotted.

Pub/sub is the channel.

Kind What it is
queue, dlq Point-to-point. One message reaches one consumer.
topic, stream Pub/sub. A record stays available to subscribers. A stream is an ordered topic, and both use the stacked-log shape.
broker The product that hosts those channels. Draw it when the product is the question.

orders => topic followed by an edge to each subscriber is pub/sub. orders => jobs is point-to-point. Omit the channel when the pipe is not the question: orders => billing is still a handoff.

diagram.kdiagram
diagram "Order placed" {
direction LR
orders: service "Orders"
topic: topic "orders.v1"
inventory: service "Inventory"
notify: worker "Notifications"
reporting: database "Reporting"
orders => topic "OrderPlaced"
topic => inventory
topic => notify
orders ~> reporting "caught up"
}

Use a separate diagram when the question changes:

  1. Map. Who publishes, which channel, who consumes, and the store that matters.
  2. Sequence. The order of one interaction, including replies.
  3. Failure. Retries, a dead-letter queue, a duplicate, or compensation.

A competing consumer pool is one => from the queue. The idle workers sit in the group with no edge, so the picture stays one delivery. A compensation such as PaymentFailed belongs on its own diagram, beside the happy path.

Sibling edges inside an arrange: stack column loop around the column. Wire across columns, or between neighbors that sit next to each other in the stack.

The gallery uses one storefront for these patterns:

Order fulfillment remains the system map. Continue with sequence diagrams when order is the question, or the language reference for the operator table.