Share via

how to set maxConcurrency in using java sdk comsos

Deepak Patil 61 Reputation points
2022-02-07T15:25:47.11+00:00

how to set maxConcurrency... getting error while running azure cosmos code java.lang.RuntimeException: java.lang.IllegalArgumentException: maxConcurrency > 0 required but it was 0

Azure Cosmos DB
Azure Cosmos DB

An Azure NoSQL database service for app development.

0 comments No comments

Answer accepted by question author

Anurag Sharma 17,636 Reputation points
2022-02-08T05:28:05.303+00:00

Hi @Deepak Patil , welcome to Microsoft Q&A forum.

We need to use below properties to get/set the concurrency in java sdk for Azure Cosmos DB:

getMaxDegreeOfParallelism

setMaxDegreeOfParallelism

This is available for all the sdk versions and we can use it with CosmosQueryRequestOptions class.

CosmosQueryRequestOptions options = new CosmosQueryRequestOptions();  
  
        // 0 maximum parallel tasks, effectively serial execution  
        options.setMaxDegreeOfParallelism(0);  

Please refer to below code snippet for more details:

azure-cosmos-java-sql-api-samples

Please let us know if this helps or else we can discuss further. If answer helps, you can mark it ' Accept Answer'.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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