liveBook · Manning

Transaction management strategy

As explained in Microservices Patterns, Second Edition

A transaction management strategy defines how transaction boundaries and consistency responsibilities are organized for a system operation.

A transaction management strategy organizes transaction boundaries for a system operation that spans domain modules. Choose among transaction-per-operation, transaction-per-domain-module, and requirements-driven boundaries; collaboration choices affect which strategy fits. section 6.2.4

The named strategies organize boundaries in different ways:

  • Transaction-per-operation implements the operation as one ACID transaction; it is the simplest and most common approach in a monolithic architecture. section 6.2.4
  • Transaction-per-domain-module and requirements-driven boundaries are alternatives; the latter bases boundaries on operation requirements. section 6.2.4

Creating an order

A single transaction can create an order, reserve credit, and send a confirmation email across Order, Consumer, and Notification Management. A Saga instead sequences transactions; if credit reservation can fail, a compensating transaction can undo earlier updates. If business-rule violations are confined to the first transaction, a simpler Saga can avoid compensation. section 6.2.4

How Microservices Patterns, Second Edition covers it

How deep it goes
Names three strategies and explains single-transaction and Saga examples, but leaves requirements-driven boundaries undeveloped.
Examples
Uses createOrder() across Order, Consumer, and Notification Management, including Saga variants with and without compensation.
What you can do after
Evaluate transaction-boundary options for an operation spanning domain modules.
How it connects
Ties transaction boundaries to ACID transactions, Saga, and Invoke, Observer, and asynchronous messaging collaboration patterns.

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.