Types of Sagas
Take a look at both types of sagas: choreographed saga and orchestrated saga.
Now, let’s take a look at both types of sagas and how we might use either to handle creating new orders in the MallBots application.
The choreographed saga
In a choreographed saga, each participant knows the role they play. With no coordinator to tell them what to do, each participant listens for the events that signal their turn. The coordination logic is spread out across the components and is not centralized.
Our example from this
The Order Processing module would publish an
OrderCreated
event after creating a new order in the pending state.The Customers module listens for
OrderCreated
events and publishes aCustomerApproved
event after confirming the customer on the order.The Depot module also listens for the
OrderCreated
event and uses the order information to create a shopping list for the bots and publishes aShoppingListCreated
event.The Payments module listens for the
OrderCreated
andCustomerApproved
events and will verify the authorized payment for the order and customer before publishing the ...