NonIdempotentWriteRetryOptions Class

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

public final class NonIdempotentWriteRetryOptions

Class to define the options for non-idempotent write operations

Constructor Summary

Constructor Description
NonIdempotentWriteRetryOptions()

Creates an instance of the NonIdempotentWriteRetryOptions class.

Method Summary

Modifier and Type Method and Description
boolean isEnabled()

Returns a flag indicating whether automatic retries for write operations even when they are not guaranteed to be idempotent are enabled or not.

boolean isTrackingIdUsed()

Returns a flag indicating whether write operations can use the trackingId system property '/_trackingId' to allow identification of conflicts and pre-condition failures due to retries.

NonIdempotentWriteRetryOptions setEnabled(boolean isEnabled)

Specifies whether automatic retries for write operations even when they are not guaranteed to be idempotent are enabled.

NonIdempotentWriteRetryOptions setTrackingIdUsed(boolean useTrackingIdForCreateAndReplace)

Specifies whether write operations can use the trackingId system property '/_trackingId' to allow identification of conflicts and pre-condition failures due to retries.

Methods inherited from java.lang.Object

Constructor Details

NonIdempotentWriteRetryOptions

public NonIdempotentWriteRetryOptions()

Creates an instance of the NonIdempotentWriteRetryOptions class.

Method Details

isEnabled

public boolean isEnabled()

Returns a flag indicating whether automatic retries for write operations even when they are not guaranteed to be idempotent are enabled or not. The default value is false.

Returns:

a flag indicating whether automatic retries for non-idempotent write operations are enabled or not.

isTrackingIdUsed

public boolean isTrackingIdUsed()

Returns a flag indicating whether write operations can use the trackingId system property '/_trackingId' to allow identification of conflicts and pre-condition failures due to retries. If enabled, each document being created or replaced will have an additional '/_trackingId' property for which the value will be updated by the SDK. If it is not desired to add this new json property (for example due to the RU-increase based on the payload size or because it causes documents to exceed the max payload size upper limit), the usage of this system property can be disabled by setting this parameter to false. This means there could be a higher level of 409/312 due to retries - and applications would need to handle them gracefully on their own.

Returns:

a flag indicating whether write operations can use the trackingId system property '/_trackingId' to allow identification of conflicts and pre-condition failures due to retries.

setEnabled

public NonIdempotentWriteRetryOptions setEnabled(boolean isEnabled)

Specifies whether automatic retries for write operations even when they are not guaranteed to be idempotent are enabled.

Parameters:

isEnabled -
  • a flag indicating whether to enable automatic retries even for non-idempotent write operations

Returns:

current options

setTrackingIdUsed

public NonIdempotentWriteRetryOptions setTrackingIdUsed(boolean useTrackingIdForCreateAndReplace)

Specifies whether write operations can use the trackingId system property '/_trackingId' to allow identification of conflicts and pre-condition failures due to retries. If enabled, each document being created or replaced will have an additional '/_trackingId' property for which the value will be updated by the SDK. If it is not desired to add this new json property (for example due to the RU-increase based on the payload size or because it causes documents to exceed the max payload size upper limit), the usage of this system property can be disabled by setting this parameter to false. This means there could be a higher level of 409/312 due to retries - and applications would need to handle them gracefully on their own.

Parameters:

useTrackingIdForCreateAndReplace - indicates whether a system property '/_trackingId' should be used to allow identification of conflicts and pre-condition failures due to retries.

Returns:

current options

Applies to