How i can set Retry policy where pushing record to cosmosDB using java.
I want to retry pushing record if its failed to push record for first time. I want to retry pushing 5 time after an interval of 2 seconds.
how i can make such changes in java i read about ConnectionPolicy in java but not able to understand how it can full fill my requirements.
reference link: https://learn.microsoft.com/bs-latn-ba/azure/cosmos-db/performance-tips-java
Code:
retryOptions = new RetryOptions();
retryOptions.setMaxRetryAttemptsOnThrottledRequests(5);
retryOptions.setMaxRetryWaitTimeInSeconds(10);
connectionPolicy = new ConnectionPolicy();
connectionPolicy.setRetryOptions(retryOptions);
documentClient = new DocumentClient(END_POINT,
MASTER_KEY, connectionPolicy,
ConsistencyLevel.Session);