SAGA Pattern for Distributed Transactions — Concept Check
Questions on SAGA Pattern for Distributed Transactions. A SAGA splits a multi-service transaction into local transactions linked by events (choreography) or an orchestrator, with compensating transactions for rollback.
Questions in this quiz
8 questions on SAGA Pattern for Distributed Transactions — Concept Check. Work through them here, then start the quiz to answer them and see your score.
1.An Order Service in a microservices architecture publishes an OrderCreatedEvent. What happens if the Payment Service fails to process this event?
- AThe Payment Service will trigger a compensating transaction in the Order Service.
- BThe Order Service will directly cancel the order without further events.
- CThe Payment Service will ignore the event and do nothing.
- DThe Order Service will automatically retry the transaction.
2.In a choreography-based SAGA, each service performs its local transaction and publishes an event. What is a potential downside of this approach?
- AIt makes the overall flow hard to visualize and debug.
- BIt enforces strong consistency across services.
- CIt creates a single point of failure in the system.
- DIt requires a central coordinator to manage the flow.
3.A developer notices that a compensating transaction is being executed twice for the same order. What could be the reason?
- AThe order ID is incorrect.
- BThe event bus is configured incorrectly.
- CThe compensating transaction is not idempotent.
- DThe original transaction was not completed successfully.
4.In an orchestration-based SAGA, what role does the SAGA Orchestrator play?
- AIt acts as a backup for failed services.
- BIt performs all local transactions itself.
- CIt listens for events but does not send commands.
- DIt drives the sequence by sending commands and listening for replies.
5.A system using the SAGA pattern is observed to have temporary inconsistent states visible to users. What is the reason for this behavior?
- AThe system is designed for eventual consistency.
- BThe system is not using compensating transactions.
- CThe choreography is missing key events.
- DThe orchestrator is not functioning correctly.
6.Which statement about the SAGA pattern is true?
- AIt always requires a central coordinator for transactions.
- BIt ensures strong consistency across all services.
- CIt decomposes a distributed transaction into local transactions with compensating transactions for rollback.
- DIt is only suitable for monolithic architectures.
7.A developer assumes that using a SAGA pattern eliminates the need for compensating transactions. Why is this assumption incorrect?
- ACompensating transactions are a fallback mechanism, not a core requirement.
- BCompensating transactions are essential for handling failures and maintaining eventual consistency.
- CThe SAGA pattern automatically handles all failures without compensation.
- DCompensating transactions are only needed in orchestration-based SAGA.
8.In a microservices architecture using a SAGA pattern, what is a benefit of eventual consistency over strong consistency?
- AIt guarantees immediate consistency across services.
- BIt improves system availability and performance.
- CIt reduces the complexity of compensating transactions.
- DIt eliminates the need for error handling.