liveBook · Manning

Saga coordination logic

As explained in Microservices Patterns, Second Edition

Saga coordination logic is the control logic that sequences saga steps, invokes participants, transfers data, and triggers compensating transactions.

Saga coordination logic selects and invokes participants in sequence, passes them request data and results from earlier steps, and runs compensating transactions in reverse order when a local transaction fails. section 9.2.3

Key design decisions include:

  • How a system command initiates the saga, and when a synchronous request receives its response. section 9.2.3
  • Whether steps run sequentially or in parallel, and how timeouts are handled. section 9.2.3

Create Order Saga

The reserveCredit() operation needs customerID from the original request and orderTotal calculated by the Order Service. Coordination logic passes both values to the participant. section 9.2.3

Figure 9.5 There are two options for sending the response that make different trade-offs between the completeness of the response and minimizing runtime coupling. The first option, which suffers from runtime coupling, waits until the saga has finished and sends a complete response. The second option sends back a partial response. While this option avoids runtime coupling, the client needs an additional mechanism to determine the final outcome.
when to send the response end

Compare waiting for saga completion to return a complete response with returning a partial response and requiring another way to learn the final outcome. section 9.2.3

How Microservices Patterns, Second Edition covers it

How deep it goes
Defines sequencing, participant invocation, data transfer, and reverse compensation, while deferring detailed coordination mechanisms and design choices.
Examples
Uses the Create Order Saga to show request and service-produced data passed to reserveCredit().
What you can do after
Understand how coordination logic sequences saga steps, transfers participant data, and handles failures through compensation.
How it connects
Links saga coordination to system commands, saga participants, local transactions, compensating transactions, and synchronous requests.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Microservices Patterns, Second Edition. The section links point to the parts of the book it draws on.