title | summary | reviewed | component | related | redirects | ||
---|---|---|---|---|---|---|---|
Simple Cosmos DB Persistence Usage |
Using Cosmos DB Persistence to store sagas |
2020-09-22 |
CosmosDB |
|
|
This sample shows a client/server scenario using non-transactional saga persistence.
The shared message contracts used by all endpoints.
- Sends the
StartOrder
message toServer
. - Receives and handles the
OrderCompleted
event.
- Receive the
StartOrder
message and initiate anOrderSaga
. OrderSaga
requests a timeout with an instance ofCompleteOrder
with the saga data.OrderSaga
publishes anOrderCompleted
event when theCompleteOrder
timeout fires.
Configure the endpoint to use Cosmos DB Persistence.
snippet: CosmosDBConfig
In the non-transactional mode the saga id is used as a partition key and thus the container needs to use /id
as the partition key path.
snippet: sagadata
snippet: thesaga