Global distribution - multi region writes using SQL API with Java SDK and ReactiveCosmosRepository

Varun Thadaka 1 Reputation point
2020-12-08T09:05:14.727+00:00

We have a project which is hosted in Azure and using Cosmos DB, and we are using com.microsoft.azure.spring.data.cosmosdb.repository.ReactiveCosmosRepository to connect to Cosmos from our application.

We now wanted to use global distribution using the SQL API (multi region write) with Java SDK and we have enabled multi region writes and did a load test and observed good number of gateway errors, which we didn't get without multi region write.

After going through Microsoft documentation, we came to know we have to make application level changes for multi region to work correctly and got below link how to implement for Java, but this is not for ReactiveCosmosRepository.

https://video2.skills-academy.com/en-us/azure/cosmos-db/tutorial-global-distribution-sql-api?tabs=dotnetv2%2Capi-async#java4-preferred-locations

Can we get any documentation for how to use multi region capability for Java SDK + ReactiveCosmosRepository integration?

Thanks,
Varun

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,632 questions
Azure Spring Apps
Azure Spring Apps
An Azure platform as a service for running Spring Boot applications at cloud scale. Previously known as Azure Spring Cloud.
124 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Navtej Singh Saini 4,226 Reputation points Microsoft Employee
    2020-12-09T16:54:47.697+00:00

    @Varun Thadaka

    We have checked with our Product team got the below response:

    You need to use the latest version of azure-spring-data-cosmos SDK. Here are the release notes.

    This detailed developer guide shows how to customize the CosmosClient. In the latest version of azure-spring-data-cosmos, you get to declare a bean of CosmosClientBuilder -> which will allow you to add preferredRegions list to the CosmosClient. Here is an example on how to customize the CosmosClient using CosmosClientBuilder bean.

    46540-bean.jpg

    Hope this helps. Please get back to us for any questions.

    Regards
    Navtej S


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.