docs: add saga flowchart

This commit is contained in:
Ilkka Seppälä
2025-04-10 20:03:04 +03:00
parent 6cadf253ba
commit 54048a1360
2 changed files with 4 additions and 0 deletions
+4
View File
@@ -31,6 +31,10 @@ Wikipedia says
> Long-running transactions (also known as the saga interaction pattern) are computer database transactions that avoid locks on non-local resources, use compensation to handle failures, potentially aggregate smaller ACID transactions (also referred to as atomic transactions), and typically use a coordinator to complete or abort the transaction. In contrast to rollback in ACID transactions, compensation restores the original state, or an equivalent, and is business-specific. For example, the compensating action for making a hotel reservation is canceling that reservation.
Flowchart
![Saga flowchart](./etc/saga-flowchart.png)
## Programmatic Example of Saga Pattern in Java
The Saga design pattern is a sequence of local transactions where each transaction updates data within a single service. It's particularly useful in a microservices architecture where each service has its own database. The Saga pattern ensures data consistency and fault tolerance across services. Here are the key components of the Saga pattern:
Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB