Compensating transaction
An operation that counteracts or semantically reverses the effects of an earlier operation when directly undoing it is unavailable or unsuitable.
Microservices Patterns, Second Edition
A transaction that semantically undoes the effects of a previously committed transaction.
- How it is used
- Handles business-rule failures after earlier saga steps have committed local updates.
- How deep it goes
- Defines when compensation is needed and explains its complexity, isolation concerns, and transaction-boundary alternatives.
- Examples
- Uses order creation, credit reservation, and order rejection to illustrate compensation after a business-rule violation.
- What you can do after
- Evaluate when saga steps need compensation and when different transaction boundaries can avoid it.
Read how Microservices Patterns, Second Edition explains compensating transaction →
Grokking Software Architecture
A transaction that applies a corrective action to counteract the effects of an earlier completed transaction.
- How it is used
- Uses compensation to correct committed work in distributed workflows and recover from inconsistent writes during network partitions.
- How deep it goes
- Explains the failure-and-correction sequence and its rationale, without providing an implementation.
- Examples
- Illustrates compensation with inventory restored after billing fails and discusses correction after a network partition.
- What you can do after
- Evaluate/understand when committed work needs explicit correction rather than a shared rollback.
Read how Grokking Software Architecture explains compensating transaction →
Architecting for Autonomy
A separately designed operation that offsets or repairs the effects of an action that cannot be directly undone.
- How it is used
- Handles recovery when a later step in a multi-system flow fails after earlier actions have changed state.
- How deep it goes
- Defines predefined, deterministic recovery and rejects agent-improvised undo calls, but does not specify individual recovery procedures.
- Examples
- Contrasts separately designed recovery for completed actions with Citi's court-mediated recovery after a mistaken payment.
- What you can do after
- Evaluate/understand recovery paths by checking whether completed actions have designed recovery rather than improvised undo.
Read how Architecting for Autonomy explains compensating transaction →
Also covered in
- Designing AI AgentsIn early access (MEAP)
- gRPC Microservices in Go
- .NET in Action, Second Edition
What to know first
- sagaA saga is a distributed transaction pattern that coordinates a sequence of local transactions and uses compensating actions to address failures.
- ACIDACID is the set of database transaction properties—atomicity, consistency, isolation, and durability—that characterize reliable transactional behavior.
- consistencyConsistency is the degree to which related data, behavior, or results agree with one another and conform to applicable rules or expectations.
- agent orchestrationAgent orchestration is the coordination of agents, their tasks, tools, and interactions to accomplish a larger objective or workflow.
Related concepts
- sagaused by · A saga is a distributed transaction pattern that coordinates a sequence of local transactions and uses compensating actions to address failures.
- monitoringuses · Monitoring is the ongoing observation and measurement of a system or process to assess its behavior or condition and detect changes, failures, or other problems.
- saga orchestratorused by · A saga orchestrator coordinates saga steps by invoking participants, maintaining saga state, and determining what to do based on their outcomes.
- backward recoveryimplemented by · Backward recovery is a failure-mitigation strategy that returns a system from an illegal intermediate state to a state equivalent to its initial legal state.
- state transitionaddresses · A state transition is a change from one defined state of a system, object, or process to another according to an action, event, condition, or rule.
Questions about compensating transaction
What is compensating transaction?
An operation that counteracts or semantically reverses the effects of an earlier operation when directly undoing it is unavailable or unsuitable.
Which Manning books explain compensating transaction?
Microservices Patterns, Second Edition, Grokking Software Architecture and Architecting for Autonomy.
What should I know before learning compensating transaction?
Manning books that teach compensating transaction usually introduce saga, ACID, consistency and agent orchestration first.
What is compensating transaction also called?
Compensating transaction is also called compensation or compensating action.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


