In an event-driven architecture, components communicate by publishing events (facts about something that has happened) and reacting to the events they care about, rather than calling each other directly.

Event-driven architecture is the natural partner of serverless and managed messaging services. It’s one of the most effective ways to architect for change: new behaviour can often be added by subscribing a new component to existing events, without touching the components that publish them.

Events, commands and queries

Confusing these is a common source of tightly coupled “event-driven” systems. If a publisher needs to know that one particular consumer acted on its message, it’s sending a command, not an event.

Events themselves come in two main styles. An event notification carries just enough to say what happened, and consumers call back for details if they need them. Event-carried state transfer includes the relevant data, so consumers don’t need to call back, at the cost of larger and more tightly specified messages.

Choreography or orchestration?

We recommend choreography between business domains and orchestration within a business process that has clear steps, error handling and compensating actions. Either way, describe the important end-to-end flows explicitly, as narrative scenarios that you can test. Otherwise nobody can say what the system as a whole actually does.

Choreography compared with orchestrationChoreographyOrchestrationOrdersEvent busOrderPlacedPaymentStockEmailWorkflow orchestrator1 Payment2 Stock3 EmailLoosely coupled; the flow is implicitExplicit flow, retries and compensation
Choreography reacts to events with no central controller; orchestration coordinates explicit steps.

The costs

Event-driven systems trade one set of problems for another, and it’s worth being honest about the new set:

Good practice