-
User sends an HTTP POST request with the expected payload to
Saga Client
to start a new transaction. -
Saga Client
generates a newtransaction ID
, starts a new instance of the orchestrator (assigning thetransaction ID
as 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 Checker
service. -
Saga Orchestrator
calls theSaga Orchestrator Activity
to persist the initial Saga state asPENDING
on Cosmos DB. -
Saga Orchestrator
calls theCommand Producer Activity
to 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. -
Validator
consumes the command generated by the orchestrator through Event Hubs, simulates a task that validates bank accounts, produces a new successful event toSaga Reply
Event Hubs and persists the service data on Cosmos DB. -
Saga Event Processor
consumes the event generated by theValidator
, persists the event data on Cosmos DB and raises an external event toSaga Orchestrator
that contains the event name. -
Saga Orchestrator
receives the external event response and calls theCommand Producer Activity
to 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. -
Transfer
consumes the command generated by the orchestrator through Event Hubs, simulates credit and debit operations on both bank accounts, produces a new successful event toSaga Reply
Event Hubs and persists the service data on Cosmos DB. -
Saga Event Processor
consumes the event generated by theTransfer
, persists the event data on Cosmos DB and raises an external event toSaga Orchestrator
that contains the event name. -
Saga Orchestrator
receives the external event response and calls theCommand Producer Activity
to 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. -
Receipt
consumes the command generated by the orchestrator through Event Hubs, generates a random receipt ID, produces a new successful event toSaga Reply Event Hub
and persists the service data on Cosmos DB. -
Saga Event Processor
consumes the event generated by theReceipt
, persists the event data on Cosmos DB and raises an external event toSaga Orchestrator
that contains the event name. -
Saga Orchestrator
receives the external event response and calls theSaga Orchestrator Activity
to update the Saga state toSUCCESS
on Cosmos DB.
Note: The requester can check the saga status and the orchestrator runtime status anytime by the
Saga Status Checker
through an HTTP GET request.
-
User sends an HTTP POST request with the expected payload to
Saga Client
to start a new transaction. -
Saga Client
generates a newtransaction ID
, starts a new instance of the orchestrator (assigning thetransaction ID
as 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 Orchestrator
calls theSaga Orchestrator Activity
to persist the initial Saga state asPENDING
on Cosmos DB. -
Saga Orchestrator
calls theCommand Producer Activity
to 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. -
Validator
consumes the command generated by the orchestrator through Event Hubs, simulates a task that validates bank accounts, produces a new successful event toSaga Reply
Event Hubs and persists the service data on Cosmos DB. -
Saga Event Processor
consumes the event generated by theValidator
, persists the event data on Cosmos DB and raises an external event toSaga Orchestrator
with the event name. -
Saga Orchestrator
receives the external event response and calls theCommand Producer Activity
to 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. -
Transfer
consumes the command generated by the orchestrator through Event Hubs, simulates credit and debit operations on both bank accounts, produces a new successful event toSaga Reply
Event Hubs and persists the service data on Cosmos DB. -
Saga Event Processor
consumes the event generated by theTransfer
, persists the event data on Cosmos DB and raises an external event toSaga Orchestrator
with the event name. -
Saga Orchestrator
receives the external event response and calls theCommand Producer Activity
to 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. -
Receipt
consumes the command generated by the orchestrator through Event Hubs, an error occurs on generating the receipt ID, theFAILED
task result is persisted on Cosmos DB and a new failed event is produced toSaga Reply Event Hub
. -
Saga Event Processor
consumes the event generated by theReceipt
, persists the event data on Cosmos DB and raises an external event toSaga Orchestrator
with theFAILED
state. -
Saga Orchestrator
receives the external event response and calls theCommand Producer Activity
to 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. -
Transfer
consumes 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 Reply
Event Hubs and persists the service data on Cosmos DB. -
Saga Event Processor
consumes the compensation event generated by theTransfer
, persists the event data on Cosmos DB and raises an external event toSaga Orchestrator
with the event name. -
Saga Orchestrator
receives the external event response and calls theSaga Orchestrator Activity
to update the Saga state toCANCELLED
on Cosmos DB.