Medium1 markMultiple Choice
Domain 4.2: Design an application architectureDomain 4Application ArchitectureMicroservicesDesign Patterns

AZ-305 · Question 45 · Domain 4.2: Design an application architecture

You are designing a distributed microservices architecture for a travel booking system.

Booking a vacation requires three steps: booking a flight, booking a hotel, and processing payment. Each step is handled by a separate microservice with its own database.

If the flight and hotel are booked successfully, but the payment processing fails, the system must automatically cancel the flight and hotel bookings to maintain data consistency.

Which architectural pattern should you implement?

Answer options:

A.

Command and Query Responsibility Segregation (CQRS)

B.

Saga pattern

C.

Circuit Breaker pattern

D.

Event Sourcing

How to approach this question

Recognize the scenario: distributed transactions across multiple databases requiring 'compensating transactions' (rollbacks).

Full Answer

B.Saga pattern✓ Correct
Saga pattern
In a microservices architecture, you cannot use traditional ACID transactions across multiple databases (two-phase commit). Instead, you use the Saga pattern. 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 local transaction fails (e.g., payment fails), the saga executes a series of compensating transactions that undo the changes made by the preceding local transactions (e.g., canceling the flight).

Common mistakes

Confusing CQRS or Event Sourcing with Saga. They are often used together, but Saga specifically handles the distributed transaction/rollback logic.

Practice the full Azure Solutions Architect Expert AZ-305 Practice Exam 3

55 questions · hints · full answers · grading

More questions from this exam