Cosmos DB

An Azure Cosmos DB connection can be used to connect your Active Caching module to a Cosmos DB database. This allows modules to persist modifications to Cosmos DB and retrieve saved values when the module first creates an object.

To connect to a Cosmos DB database, supply a set of credentials for an Azure Cosmos DB account that has permissions to create/access/modify tables and create/read/update/delete items. The Azure credentials are provided through the UI when you create a new Cosmos DB connector and consist of:

  • Account URI: the URI to the Azure Cosmos DB account where the containers will be added.

  • Primary key: the primary Read-Write key for the Cosmos DB account.

  • Table Name: the name of the Cosmos DB table to be used for persisting instances (“ScaleoutModuleInstances” is the suggested name for easy identification).

Values for these properties can be found in the Keys section of the Cosmos DB account:

cosmosDbCreds

To configure the connection to Cosmos DB, open the ScaleOut Active Caching UI in your web browser and enter the connection information:

cosmosdb_config_image

Enable Cosmos DB Persistence for a Module

When launching your model through the ScaleOut Active Caching UI, you can enable persistence by selecting the Cosmos DB persistence provider you have defined above. If write-through is enabled, this will cause instances in your module to periodically persist themselves to Cosmos DB every five seconds (if the object has been modified). If read-through is enabled, this will cause instances to retrieve their state from Cosmos DB when they are first created.

cosmosdb_deploy_module_image