liveBook · Manning

Event-driven architecture

As explained in Grokking Software Architecture

A software architecture in which components communicate and trigger processing by producing and consuming events.

Event-driven architecture lets services communicate asynchronously: a producer announces a fact about something that happened, and a consumer processes it when ready. A broker buffers the event, so the sender does not need the receiver to be online. The delay between an event being sent and processed is real, so systems must allow for eventual consistency. section 7.9 section 7.1.1

Look for these roles and code patterns:

  • Producer: publishes an event and moves on. section 7.9
  • Broker: holds messages so consumers can process them later. section 7.9
  • Consumer: reacts to an incoming message; its handler can replace a controller action as an entry point. section 7.5.4
  • Shared contracts define event payloads, while an IEventPublisher interface keeps domain logic separate from broker implementations. section 7.5.4

An order arrives

The Order Service publishes OrderPlaced. If the Shipping Service is unavailable, the broker can hold the event; when the consumer is ready, it can process the message and print a shipping label. The order service does not have to wait for shipping to come back online. section 7.5.4 section 7.9

Events report what has already happened, rather than telling another service what to do. Name them in the past tense, keep them immutable, and include only the data needed. Acknowledgments and dead-letter queues help handle delivery failures and messages that repeatedly crash consumers; structured logs and correlation IDs help trace activity across services. section 7.9

The tradeoff is not simply performance: asynchronous processing introduces a time gap and eventual consistency. Choose this style when services should remain available independently, and design for delayed processing rather than pretending the gap is gone. section 7.9 section 7.1.1

How Grokking Software Architecture covers it

How deep it goes
Explains producer, broker, and consumer roles, code structure, and delivery safeguards, while keeping broker implementations behind an interface.
Examples
Uses an Order Service publishing OrderPlaced for a Shipping Service consumer, with a shared contract and shipping-label handler.
What you can do after
Understand how producers, brokers, and consumers keep services working independently despite delayed processing.
How it connects
Connects asynchronous communication to temporal coupling, eventual consistency, message brokers, and hexagonal architecture.

Also explained in

Compare how 14 books explain event-driven architecture →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.