-
User sends an HTTP POST request with the expected payload to
Saga Clientto start a new transaction. -
Saga Clientgenerates a newtransaction ID, starts a new instance of the orchestrator (assigning thetransaction IDas the orchestratorinstance ID) and provides the transaction ID as part of the HTTP POST response, allowing the requester to pool the saga status through theSaga Status Checkerservice. -
Saga Orchestratorcalls theSaga Orchestrator Activityto persist the initial Saga state asPENDINGon Cosmos DB. -
Saga Orchestratorcalls theCommand Producer Activityto produce a new command to Event Hubs to validate bank accounts. In the meantime, it waits for an external event that tells the result of the validation to move to the next step of the workflow. -
Validatorconsumes the command generated by the orchestrator through Event Hubs, simulates a task that validates bank accounts, produces a new successful event toSaga ReplyEvent Hubs and persists the service data on Cosmos DB. -
Saga Event Processorconsumes the event generated by theValidator, persists the event data on Cosmos DB and raises an external event toSaga Orchestratorthat contains the event name. -
Saga Orchestratorreceives the external event response and calls theCommand Producer Activityto produce a new command to Event Hubs and starts the transfer process. In the meantime, it waits for an external event that tells the result of the transfer to move to the next step of the workflow. -
Transferconsumes the command generated by the orchestrator through Event Hubs, simulates credit and debit operations on both bank accounts, produces a new successful event toSaga ReplyEvent Hubs and persists the service data on Cosmos DB. -
Saga Event Processorconsumes the event generated by theTransfer, persists the event data on Cosmos DB and raises an external event toSaga Orchestratorthat contains the event name. -
Saga Orchestratorreceives the external event response and calls theCommand Producer Activityto produce a new command to Event Hubs to create the transaction receipt. In the meantime, it waits for an external event that tells the result of the receipt generation process to finish the Saga. -
Receiptconsumes the command generated by the orchestrator through Event Hubs, generates a random receipt ID, produces a new successful event toSaga Reply Event Huband persists the service data on Cosmos DB. -
Saga Event Processorconsumes the event generated by theReceipt, persists the event data on Cosmos DB and raises an external event toSaga Orchestratorthat contains the event name. -
Saga Orchestratorreceives the external event response and calls theSaga Orchestrator Activityto update the Saga state toSUCCESSon Cosmos DB.
Note: The requester can check the saga status and the orchestrator runtime status anytime by the
Saga Status Checkerthrough an HTTP GET request.
-
User sends an HTTP POST request with the expected payload to
Saga Clientto start a new transaction. -
Saga Clientgenerates a newtransaction ID, starts a new instance of the orchestrator (assigning thetransaction IDas the orchestratorinstance ID) and provides the transaction ID as part of the HTTP POST response, allowing the user to query the status of the saga and the orchestrator runtime. -
Saga Orchestratorcalls theSaga Orchestrator Activityto persist the initial Saga state asPENDINGon Cosmos DB. -
Saga Orchestratorcalls theCommand Producer Activityto produce a new command to Event Hubs to validate bank accounts. In the meantime, it waits for an external event that tells the result of the validation to move to the next step of the workflow. -
Validatorconsumes the command generated by the orchestrator through Event Hubs, simulates a task that validates bank accounts, produces a new successful event toSaga ReplyEvent Hubs and persists the service data on Cosmos DB. -
Saga Event Processorconsumes the event generated by theValidator, persists the event data on Cosmos DB and raises an external event toSaga Orchestratorwith the event name. -
Saga Orchestratorreceives the external event response and calls theCommand Producer Activityto produce a new command to Event Hubs and starts the transfer process. In the meantime, it waits for an external event that tells the result of the transfer to move to the next step of the workflow. -
Transferconsumes the command generated by the orchestrator through Event Hubs, simulates credit and debit operations on both bank accounts, produces a new successful event toSaga ReplyEvent Hubs and persists the service data on Cosmos DB. -
Saga Event Processorconsumes the event generated by theTransfer, persists the event data on Cosmos DB and raises an external event toSaga Orchestratorwith the event name. -
Saga Orchestratorreceives the external event response and calls theCommand Producer Activityto produce a new command to Event Hubs to create the transaction receipt. In the meantime, it waits for an external event that tells the result of the receipt generation process to finish the Saga. -
Receiptconsumes the command generated by the orchestrator through Event Hubs, an error occurs on generating the receipt ID, theFAILEDtask result is persisted on Cosmos DB and a new failed event is produced toSaga Reply Event Hub. -
Saga Event Processorconsumes the event generated by theReceipt, persists the event data on Cosmos DB and raises an external event toSaga Orchestratorwith theFAILEDstate. -
Saga Orchestratorreceives the external event response and calls theCommand Producer Activityto produce a new compensation command to Event Hubs to compensate the transfer process. In the meantime, it waits for an external event that tells the result of the compensating transaction to finish the Saga. -
Transferconsumes the compensation command generated by the orchestrator through Event Hubs, undo the credit and debit operations on both bank accounts, produces a new compensation event toSaga ReplyEvent Hubs and persists the service data on Cosmos DB. -
Saga Event Processorconsumes the compensation event generated by theTransfer, persists the event data on Cosmos DB and raises an external event toSaga Orchestratorwith the event name. -
Saga Orchestratorreceives the external event response and calls theSaga Orchestrator Activityto update the Saga state toCANCELLEDon Cosmos DB.

