SessionRetryOptionsBuilder Class

  • java.lang.Object
    • com.azure.cosmos.SessionRetryOptionsBuilder

public final class SessionRetryOptionsBuilder

A SessionRetryOptionsBuilder instance will be used to build a SessionRetryOptions instance.

Constructor Summary

Constructor Description
SessionRetryOptionsBuilder()

Method Summary

Modifier and Type Method and Description
SessionRetryOptions build()

Builds an instance of SessionRetryOptions

SessionRetryOptionsBuilder maxRetriesPerRegion(int maxRetriesPerRegion)

Sets the maximum number of retries within each region for read and write operations.

SessionRetryOptionsBuilder minTimeoutPerRegion(Duration minTimeoutPerRegion)

Sets the minimum retry time for 404/1002 retries within each region for read and write operations.

SessionRetryOptionsBuilder regionSwitchHint(CosmosRegionSwitchHint regionSwitchHint)

Sets the CosmosRegionSwitchHint which specifies for a request whether internal retry policies should prioritize a local region or a remote region.

Methods inherited from java.lang.Object

Constructor Details

SessionRetryOptionsBuilder

public SessionRetryOptionsBuilder()

Method Details

build

public SessionRetryOptions build()

Builds an instance of SessionRetryOptions

Returns:

An instance of SessionRetryOptions

maxRetriesPerRegion

public SessionRetryOptionsBuilder maxRetriesPerRegion(int maxRetriesPerRegion)

Sets the maximum number of retries within each region for read and write operations. The minimum value is 1 - the backoff time for the last in-region retry will ensure that the total retry time within the region is at least the min. in-region retry time.

Parameters:

maxRetriesPerRegion - the max. number of retries with-in each region

Returns:

minTimeoutPerRegion

public SessionRetryOptionsBuilder minTimeoutPerRegion(Duration minTimeoutPerRegion)

Sets the minimum retry time for 404/1002 retries within each region for read and write operations. The minimum value is 100ms - this minimum is enforced to provide a way for the local region to catch-up on replication lag. The default value is 500ms - as a recommendation ensure that this value is higher than the steady-state replication latency between the regions you chose.

Parameters:

minTimeoutPerRegion - the min retry time to be used with-in each region

Returns:

regionSwitchHint

public SessionRetryOptionsBuilder regionSwitchHint(CosmosRegionSwitchHint regionSwitchHint)

Sets the CosmosRegionSwitchHint which specifies for a request whether internal retry policies should prioritize a local region or a remote region.

NOTES:

  • null values are not allowed

Parameters:

regionSwitchHint - The region switch hint

Returns:

Applies to