liveBook · Manning

Choreography

As explained in Grokking Software Architecture

Choreography is a distributed coordination style in which services react independently to events rather than following commands from a central coordinator.

Imagine a workplace where people post updates instead of waiting for a manager to assign every next step. Choreography coordinates services the same way: each service announces what happened, and other services react independently. There is no central service directing the workflow. section 7.9 section 12.6.1

An event is a news report, not an instruction. Name it in the past tense, such as OrderPlaced; make it immutable; and include only the data needed for the story. By contrast, orchestration uses a central manager to command the other services. section 7.9 section 12.6.1

A checkout saga

Checkout saves an order and publishes OrderPlaced. Inventory reacts by deducting stock and publishing InventorySecured. Billing then charges the card and publishes PaymentSecured. Each service performs its own local update and publishes an event that can prompt the next reaction. section 12.6.1

A failed payment needs cleanup, not a shared rollback button. Billing publishes PaymentFailed; Inventory reacts by putting the stock back, while Checkout marks the order as failed. These compensating transactions reverse or address work already performed by independent services. section 12.6.1

Figure 12.5 The Saga Failure Path. Because independent Microservices cannot share a single ACID "rollback" button, they must clean up after each other. When the downstream payment fails, it triggers a Compensating Transaction, forcing the upstream Inventory service to manually reverse its work.

Follow the failure path from a declined payment to Inventory's compensating transaction. section 12.6.1

Independent reactions can reduce the risk that one failure topples an entire chain, but the distributed story is harder to reconstruct. Use structured logs and correlation IDs to follow it; acknowledgments support delivery, while dead-letter queues catch problematic messages that could repeatedly crash consumers. section 7.1 section 7.9

How Grokking Software Architecture covers it

How deep it goes
Walks through successful and failed sagas, including compensating transactions, without a code implementation.
Examples
Follows checkout, inventory, and billing through a successful order and a declined payment.
What you can do after
Evaluate choreography against central orchestration and understand how events and compensating transactions coordinate a saga.
How it connects
Connects choreography to event-driven architecture, orchestration, sagas, compensating transactions, and temporal coupling.

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.