Microservice SAGA Pattern Explained

Anish Antony
7 min readDec 11, 2021
Photo by Andrey Tikhonovskiy on Unsplash

A microservice-based application is a distributed system. The overall system consists of multiple smaller services, and together these services provide the overall application functionality. This architectural style provides numerous benefits, it has several limitations as well. One of the major problems in a microservice architecture is how to handle a transaction that spans across multiple services. Before moving on to more detail about SAGA you should need to know about ACID properties of transactions.

#1. ACID properties of Transactions

ACID refers to the four key properties of a transaction: atomicity, consistency, isolation, and durability.

Atomicity: All changes to data are performed as if they are a single operation. That is, all the changes are performed, or none of them are. For example, in an application that transfers funds from one account to another, the atomicity property ensures that, if a debit is made successfully from one account, the corresponding credit is made to the other account.

Consistency: Data is in a consistent state when a transaction starts and when it ends. For example, in an application that transfers funds from one account to another, the consistency property ensures that the total value of funds in both the accounts is the same at the start and end…

--

--

Anish Antony

Fullstack Developer | Blogger | Experience on Java, Python, React, Angular, Golang | http://www.behindjava.com