Using Azure Cosmos DB as a state store
Instead of using the local Redis storage, we are going to leverage another Dapr state store option, Azure Cosmos DB, a globally distributed, multi-model database service.
The steps needed to configure the new state store are as follows:
- Setting up Azure Cosmos DB
- Configuring the state store
- Testing the state store
- Partitioning with Cosmos DB
- Wrapping up
The application code of reservation-store
will not be changed; we will only operate at the configuration level of the state store component.
We’ll start by setting up the Azure Cosmos DB resource.
Setting up Azure Cosmos DB
To create a Cosmos DB instance on Azure, please follow this guide in the Azure documentation: https://docs.microsoft.com/en-us/azure/cosmos-db/how-to-manage-database-account.
You should also take a look at the Dapr documentation for the same purpose: https://docs.dapr.io/developing-applications/building-blocks/state-management...