Get free Big O Cheatsheet

Get free Big O Cheatsheet

Get Free Big O Cheatsheet

To get free Big O cheatsheet, Fill in your name and email to get your copy.

Do not scared, we do not spam your inbox.

If you encounter any problem with download, please reach us via the messanger (Bottom right)

Start learning

📚 Micro services Architecture and Design patterns.
📚 Data Structures and Algorithm
Download 🔽 Your Free Big O Cheatsheet 🏁 now.

What are the Saga design pattern and types available?

What are the Saga design pattern and types available?

What are the Saga design pattern and types available?

Today we will see what are the Saga Design Pattern and types available.

Previously we saw about What is Microservice? and the principles followed while developing MSA and the available design patterns.

What are the Saga design pattern and types available?

The Saga Pattern is a microservices architectural pattern to implement a transaction that extends multiple services.

A saga is a sequence of local transactions. Each service in a saga performs its own transaction and publishes an event. The other services listen to that event and perform the next local transaction. If one transaction fails for some reason, the saga also executes compensating transactions to undo the impact of the preceding transactions.


Consider a Food delivery service flow, When a user places an order, below could be the flow.

  1. The food ordering service creates an order. At this point, the order is in PENDING status.
  2. With the Saga pattern, it contacts the restaurant via the restaurant service.
  3. The restaurant service attempts to place an order with the selected restaurant, Once the order is received by Restaurant it sends back an ORDER_ACCEPTED (if the order is accepted) or ORDER_REJECTED (if the order cannot be accepted) status.
  4. The saga received the status ORDER_ACCEPTED or ORDER_REJECTED status and process the response to the customer accordingly.
  5. The food order service then changes the status of the order, if the order is accepted then it displays an order confirmation message if the order is rejected it display an apologies message and suggest alternative restaurants.

What are the sage design pattern and types available?

Types of Saga:

  1. Orchestration-based saga
  2. Choreography-based saga

In the next article, we will see in detail about the Type of Saga design patterns.




December 07, 2021

Senior Developer | Java & C#.NET | 10++ years of IT experience.

Planning to learn ReactJS or Angular or Flutter.!

Pin It on Pinterest