WAF Compensation Transaction Pattern

July 22, 2025277 words2 min read
azure
design patterns
reliability
self healing

WAF Compensation Transaction Pattern

CategoryDescriptionWAF Description
WhatA 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 withLong-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.
WhenWhen 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 ForScenarios 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 ToSaga 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.

If you want to get in touch and hear more about this topic, feel free to contact me on or via .

© 2025 Andrei Bodea