Reputation: 169
In CosmosDB SDK v2 it is possible to setup preferred locations during client creation (via ConnectionPolicy.PreferredLocations setting). However, I don't see similar setting in Cosmos DB SDK v3. As per my understanding, the closest setting in v3 is CosmosClientOptions.ApplicationRegion, but it allows to provide single region only.
Is there a way to to setup list of preferred locations in SDK v3?
Upvotes: 3
Views: 3656
Reputation: 15603
V3 SDK takes a different approach. By specifying the ApplicationRegion
(the region where your app is actually running), it will automatically populate the priority of regions based on proximity and account availability (the regions your account is provisioned to) to optimize latency.
If your app runs in West US and your Cosmos DB account is in East US, Europe, and West US, when you set the ApplicationRegion
to West US, it will automatically create the preferred list as West US, East US, and Europe (order of distance).
You just need to focus on defining which region your application runs.
Upvotes: 6