Medium1 markMultiple Choice
AZ-305 · Question 44 · Domain 4.2: Application Architecture
You are designing a distributed microservices application.
A business transaction spans three microservices: Order, Payment, and Inventory. Each microservice has its own dedicated database. If the Order and Payment steps succeed, but the Inventory step fails (e.g., item out of stock), the system must undo the Order and Payment steps to maintain data consistency.
Which architectural pattern should you implement?
You are designing a distributed microservices application.
A business transaction spans three microservices: Order, Payment, and Inventory. Each microservice has its own dedicated database. If the Order and Payment steps succeed, but the Inventory step fails (e.g., item out of stock), the system must undo the Order and Payment steps to maintain data consistency.
Which architectural pattern should you implement?
Answer options:
A.
Two-Phase Commit (2PC)
B.
Saga pattern
C.
Command and Query Responsibility Segregation (CQRS)
D.
Circuit Breaker pattern
How to approach this question
Identify the standard microservices pattern used for managing distributed transactions and rollbacks.
Full Answer
B.Saga pattern✓ Correct
Saga pattern
In a microservices architecture where each service has its own database, traditional ACID transactions (like Two-Phase Commit) are difficult to implement and scale poorly. The Saga pattern is the recommended approach. A saga is a sequence of local transactions. Each local transaction updates the database and publishes a message to trigger the next step. If a step fails, the saga executes 'compensating transactions' to undo the changes made by the preceding steps.
Common mistakes
Choosing Two-Phase Commit. While 2PC does distributed transactions, it is an anti-pattern in cloud-native microservices due to blocking and tight coupling.
Practice the full Azure Solutions Architect Expert AZ-305 Practice Exam 2
55 questions · hints · full answers · grading
More questions from this exam
Q01Fabrikam Inc. is a global financial services company with 200 Azure subscriptions managed via a c...HardQ02A healthcare organization has 500 on-premises Windows Server VMs and 300 Azure VMs. They are impl...HardQ03You are designing a security monitoring solution using Microsoft Sentinel.
The compliance depar...EasyQ04Your company has a microservices application deployed across multiple Azure App Service instances...MediumQ05A defense contractor is migrating to Microsoft 365 and Azure. They have a strict security policy ...Hard
Expert