WAF Compensation Transaction Pattern
July 22, 2025•277 words•2 min read•
azure
design patterns
reliability
self healing
Category | Description | WAF Description |
---|---|---|
What | A design approach that handles failures in a sequence of operations by executing defined undo or rollback actions to revert the system to a stable state. | Supports resilience and consistency in distributed systems where traditional ACID transactions aren't feasible, enabling eventual consistency with recoverability. |
Used with | Long-running, multi-step workflows across services, such as order processing, financial operations, or any business process where steps may fail partway. | Enhances operational excellence by isolating failure handling per step, and supports reliability through controlled compensation logic. |
When | When operations can't be committed atomically due to distributed service boundaries and need a way to roll back only the affected parts of the process. | Promotes reliability and fault tolerance by minimizing the blast radius of failures and supporting loosely coupled service designs. |
Not Suitable For | Scenarios requiring strong consistency and atomicity across multiple steps, or where compensating logic is complex, risky, or impossible to implement. | May impact reliability and maintainability if compensations are inconsistent, side-effect-prone, or hard to define; operational excellence depends on strong monitoring. |
Related To | Saga Pattern, Eventual Consistency, Workflow Orchestration, Distributed Transactions, Retry Pattern. | Scheduler Agent Supervisor pattern, Retry pattern, Saga distributed transactions pattern, Pipes and Filters pattern |
A basic implementation of the Compensation Transaction Pattern can be found here.
The full WAF description of the pattern can be found here.