The Saga Pattern is a design pattern for managing a sequence of local transactions, where each transaction updates data within a single service and publishes an event or message to trigger the next step. If a step fails, the saga executes a series of compensating transactions—predefined actions that semantically undo the effects of the preceding successful steps. This approach provides an alternative to distributed locking mechanisms like Two-Phase Commit (2PC), trading immediate consistency for eventual consistency and improved availability in partitioned systems.
