What is the purpose of the saga design pattern?

What is the purpose of the saga design pattern?

The saga design pattern is a way to manage data consistency across microservices in distributed transaction scenarios. A saga is a sequence of transactions that updates each service and publishes a message or event to trigger the next transaction step.

Which is the best description of the saga?

1 : a prose narrative recorded in Iceland in the 12th and 13th centuries of historic or legendary figures and events of the heroic age of Norway and Iceland. 2 : a modern heroic narrative resembling the Icelandic saga.

What does consistency and durability mean in Saga?

Consistency means the transaction brings the data only from one valid state to another valid state. Isolation guarantees that concurrent transactions produce the same data state that sequentially executed transactions would have produced. Durability ensures that committed transactions remain committed even in case of system failure or power outage.

Which is the last compensable transaction in Saga?

A pivot transaction can be a transaction that is neither compensable nor retryable, or it can be the last compensable transaction or the first retryable transaction in the saga. Retryable transactions are transactions that follow the pivot transaction and are guaranteed to succeed.

How are events and transactions related in Saga?

Within a transaction, an event is a state change that occurs to an entity, and a command encapsulates all information needed to perform an action or trigger a later event. Transactions must be atomic, consistent, isolated, and durable (ACID).

What are lost updates and dirty reads in Saga?

Lost updates, when one saga writes without reading changes made by another saga. Dirty reads, when a transaction or a saga reads updates made by a saga that has not yet completed those updates. Fuzzy/nonrepeatable reads, when different saga steps read different data because a data update occurs between the reads.

Why is integration testing so difficult in Saga?

There’s a risk of cyclic dependency between saga participants because they have to consume each other’s commands. Integration testing is difficult because all services must be running to simulate a transaction. Orchestration is a way to coordinate sagas where a centralized controller tells the saga participants what local transactions to execute.