CosmosRequestOptions Class

  • java.lang.Object
    • com.azure.cosmos.models.CosmosRequestOptions

public final class CosmosRequestOptions

The common request options for operations. This class should be used with the addPolicy method in the CosmosClientBuilder to change request options without restarting the application.

Constructor Summary

Constructor Description
CosmosRequestOptions()

Method Summary

Modifier and Type Method and Description
ConsistencyLevel getConsistencyLevel()

Gets the consistency level.

CosmosEndToEndOperationLatencyPolicyConfig getCosmosEndToEndLatencyPolicyConfig()

Gets the CosmosEndToEndLatencyPolicyConfig.

CosmosItemSerializer getCustomItemSerializer()

Gets the custom item serializer.

DedicatedGatewayRequestOptions getDedicatedGatewayRequestOptions()

Gets the dedicated gateway request options.

CosmosDiagnosticsThresholds getDiagnosticsThresholds()

Gets the diagnostics thresholds.

List<String> getExcludedRegions()

Gets the exclude regions.

Set<String> getKeywordIdentifiers()

Gets the keywordIdentifiers.

Integer getMaxBufferedItemCount()

Gets the max buffered item count.

Integer getMaxDegreeOfParallelism()

Gets the max degree of parallelism.

Integer getMaxItemCount()

Gets the max item count.

Integer getMaxPrefetchPageCount()

Gets the max prefetch page count.

Boolean getNonIdempotentWriteRetriesEnabled()

Gets the non idempotent write retries enabled.

String getQueryName()

Gets the query name.

ReadConsistencyStrategy getReadConsistencyStrategy()

Gets the read consistency strategy.

Integer getResponseContinuationTokenLimitInKb()

Gets the response continuation token limit in KB.

String getThroughputControlGroupName()

Gets the throughput control group name.

Boolean isContentResponseOnWriteEnabled()

Gets the content response on write enabled.

Boolean isIndexMetricsEnabled()

Gets the index metrics enabled.

Boolean isQueryAdviceEnabled()

Gets the queryAdviceEnabled flag.

Boolean isQueryMetricsEnabled()

Gets the query metrics enabled.

Boolean isScanInQueryEnabled()

Gets the scan in query enabled.

CosmosRequestOptions setConsistencyLevel(ConsistencyLevel consistencyLevel)

Sets the consistency level.

CosmosRequestOptions setContentResponseOnWriteEnabled(Boolean contentResponseOnWriteEnabled)

Sets the content response on write enabled.

CosmosRequestOptions setCosmosEndToEndLatencyPolicyConfig(CosmosEndToEndOperationLatencyPolicyConfig endToEndOperationLatencyPolicyConfig)

Sets the CosmosEndToEndLatencyPolicyConfig.

CosmosRequestOptions setCustomItemSerializer(CosmosItemSerializer customItemSerializer)

Sets the custom item serializer.

CosmosRequestOptions setDedicatedGatewayRequestOptions(DedicatedGatewayRequestOptions dedicatedGatewayRequestOptions)

Sets the DedicatedGatewayRequestOptions.

CosmosRequestOptions setDiagnosticsThresholds(CosmosDiagnosticsThresholds thresholds)

Sets the CosmosDiagnosticsThresholds.

CosmosRequestOptions setExcludeRegions(List<String> excludeRegions)

Sets the exclude regions.

CosmosRequestOptions setIndexMetricsEnabled(Boolean indexMetricsEnabled)

Sets the IndexMetricsEnabled.

CosmosRequestOptions setKeywordIdentifiers(Set<String> keywordIdentifiers)

Sets the keywordIdentifiers.

CosmosRequestOptions setMaxBufferedItemCount(Integer maxBufferedItemCount)

Sets the MaxBufferedItemCount.

CosmosRequestOptions setMaxDegreeOfParallelism(Integer maxDegreeOfParallelism)

Sets the MaxDegreeOfParallelism.

CosmosRequestOptions setMaxItemCount(Integer maxItemCount)

Sets the MaxItemCount.

CosmosRequestOptions setMaxPrefetchPageCount(Integer maxPrefetchPageCount)

Sets the MaxPrefetchPageCount.

CosmosRequestOptions setNonIdempotentWriteRetriesEnabled(Boolean nonIdempotentWriteRetriesEnabled)

Sets the NonIdempotentWriteRetriesEnabled.

CosmosRequestOptions setQueryAdviceEnabled(Boolean queryAdviceEnabled)

Sets queryAdviceEnabled, which is used to obtain query advice to understand aspects of the query that can be optimized.

CosmosRequestOptions setQueryMetricsEnabled(Boolean queryMetricsEnabled)

Sets the QueryMetricsEnabled.

CosmosRequestOptions setQueryName(String queryName)

Sets the QueryName.

CosmosRequestOptions setReadConsistencyStrategy(ReadConsistencyStrategy readConsistencyStrategy)

Sets the read consistency strategy.

CosmosRequestOptions setResponseContinuationTokenLimitInKb(Integer responseContinuationTokenLimitInKb)

Sets the ResponseContinuationTokenLimitInKb.

CosmosRequestOptions setScanInQueryEnabled(Boolean scanInQueryEnabled)

Sets the ScanInQueryEnabled.

CosmosRequestOptions setThroughputControlGroupName(String throughputControlGroupName)

Sets the throughput control group name.

Methods inherited from java.lang.Object

Constructor Details

CosmosRequestOptions

public CosmosRequestOptions()

Method Details

getConsistencyLevel

public ConsistencyLevel getConsistencyLevel()

Gets the consistency level.

Returns:

the consistency level.

getCosmosEndToEndLatencyPolicyConfig

public CosmosEndToEndOperationLatencyPolicyConfig getCosmosEndToEndLatencyPolicyConfig()

Gets the CosmosEndToEndLatencyPolicyConfig.

Returns:

the CosmosEndToEndLatencyPolicyConfig.

getCustomItemSerializer

public CosmosItemSerializer getCustomItemSerializer()

Gets the custom item serializer.

Returns:

the custom item serializer.

getDedicatedGatewayRequestOptions

public DedicatedGatewayRequestOptions getDedicatedGatewayRequestOptions()

Gets the dedicated gateway request options.

Returns:

the dedicated gateway request options.

getDiagnosticsThresholds

public CosmosDiagnosticsThresholds getDiagnosticsThresholds()

Gets the diagnostics thresholds.

Returns:

the diagnostics thresholds.

getExcludedRegions

public List<String> getExcludedRegions()

Gets the exclude regions.

Returns:

the exclude regions.

getKeywordIdentifiers

public Set<String> getKeywordIdentifiers()

Gets the keywordIdentifiers.

Returns:

the keywordIdentifiers.

getMaxBufferedItemCount

public Integer getMaxBufferedItemCount()

Gets the max buffered item count.

Returns:

the max buffered item count.

getMaxDegreeOfParallelism

public Integer getMaxDegreeOfParallelism()

Gets the max degree of parallelism.

Returns:

the max degree of parallelism.

getMaxItemCount

public Integer getMaxItemCount()

Gets the max item count.

Returns:

the max item count.

getMaxPrefetchPageCount

public Integer getMaxPrefetchPageCount()

Gets the max prefetch page count.

Returns:

the max prefetch page count.

getNonIdempotentWriteRetriesEnabled

public Boolean getNonIdempotentWriteRetriesEnabled()

Gets the non idempotent write retries enabled.

Returns:

the non idempotent write retries enabled.

getQueryName

public String getQueryName()

Gets the query name.

Returns:

the query name.

getReadConsistencyStrategy

public ReadConsistencyStrategy getReadConsistencyStrategy()

Gets the read consistency strategy.

Returns:

the read consistency strategy.

getResponseContinuationTokenLimitInKb

public Integer getResponseContinuationTokenLimitInKb()

Gets the response continuation token limit in KB.

Returns:

the response continuation token limit in KB.

getThroughputControlGroupName

public String getThroughputControlGroupName()

Gets the throughput control group name.

Returns:

the throughput control group name.

isContentResponseOnWriteEnabled

public Boolean isContentResponseOnWriteEnabled()

Gets the content response on write enabled.

Returns:

the content response on write enabled.

isIndexMetricsEnabled

public Boolean isIndexMetricsEnabled()

Gets the index metrics enabled.

Returns:

the index metrics enabled.

isQueryAdviceEnabled

public Boolean isQueryAdviceEnabled()

Gets the queryAdviceEnabled flag.

Returns:

the queryAdviceEnabled flag.

isQueryMetricsEnabled

public Boolean isQueryMetricsEnabled()

Gets the query metrics enabled.

Returns:

the query metrics enabled.

isScanInQueryEnabled

public Boolean isScanInQueryEnabled()

Gets the scan in query enabled.

Returns:

the scan in query enabled.

setConsistencyLevel

public CosmosRequestOptions setConsistencyLevel(ConsistencyLevel consistencyLevel)

Sets the consistency level.

Parameters:

consistencyLevel - the consistency level.

Returns:

current CosmosRequestOptions.

setContentResponseOnWriteEnabled

public CosmosRequestOptions setContentResponseOnWriteEnabled(Boolean contentResponseOnWriteEnabled)

Sets the content response on write enabled.

Parameters:

contentResponseOnWriteEnabled - the content response on write enabled.

Returns:

current CosmosRequestOptions.

setCosmosEndToEndLatencyPolicyConfig

public CosmosRequestOptions setCosmosEndToEndLatencyPolicyConfig(CosmosEndToEndOperationLatencyPolicyConfig endToEndOperationLatencyPolicyConfig)

Sets the CosmosEndToEndLatencyPolicyConfig.

Parameters:

endToEndOperationLatencyPolicyConfig - the CosmosEndToEndLatencyPolicyConfig.

Returns:

current CosmosRequestOptions.

setCustomItemSerializer

public CosmosRequestOptions setCustomItemSerializer(CosmosItemSerializer customItemSerializer)

Sets the custom item serializer.

Parameters:

customItemSerializer - the custom item serializer.

Returns:

current CosmosRequestOptions.

setDedicatedGatewayRequestOptions

public CosmosRequestOptions setDedicatedGatewayRequestOptions(DedicatedGatewayRequestOptions dedicatedGatewayRequestOptions)

Sets the DedicatedGatewayRequestOptions.

Parameters:

dedicatedGatewayRequestOptions - the DedicatedGatewayRequestOptions.

Returns:

current CosmosRequestOptions.

setDiagnosticsThresholds

public CosmosRequestOptions setDiagnosticsThresholds(CosmosDiagnosticsThresholds thresholds)

Sets the CosmosDiagnosticsThresholds.

Parameters:

thresholds - the CosmosDiagnosticsThresholds.

Returns:

current CosmosRequestOptions.

setExcludeRegions

public CosmosRequestOptions setExcludeRegions(List<String> excludeRegions)

Sets the exclude regions. If all the regions are excluded, the request will be sent to the primary region for the account. The primary region is the write region in a single master account and the hub region in a multi-master account.

Parameters:

excludeRegions - the ExcludeRegions.

Returns:

current CosmosRequestOptions.

setIndexMetricsEnabled

public CosmosRequestOptions setIndexMetricsEnabled(Boolean indexMetricsEnabled)

Sets the IndexMetricsEnabled.

Parameters:

indexMetricsEnabled - the IndexMetricsEnabled.

Returns:

current CosmosRequestOptions.

setKeywordIdentifiers

public CosmosRequestOptions setKeywordIdentifiers(Set<String> keywordIdentifiers)

Sets the keywordIdentifiers.

Parameters:

keywordIdentifiers - the keywordIdentifiers.

Returns:

current CosmosCommonRequestOptions.

setMaxBufferedItemCount

public CosmosRequestOptions setMaxBufferedItemCount(Integer maxBufferedItemCount)

Sets the MaxBufferedItemCount.

Parameters:

maxBufferedItemCount - the MaxBufferedItemCount.

Returns:

current CosmosRequestOptions.

setMaxDegreeOfParallelism

public CosmosRequestOptions setMaxDegreeOfParallelism(Integer maxDegreeOfParallelism)

Sets the MaxDegreeOfParallelism.

Parameters:

maxDegreeOfParallelism - the MaxDegreeOfParallelism.

Returns:

current CosmosRequestOptions.

setMaxItemCount

public CosmosRequestOptions setMaxItemCount(Integer maxItemCount)

Sets the MaxItemCount.

Parameters:

maxItemCount - the MaxItemCount.

Returns:

current CosmosRequestOptions.

setMaxPrefetchPageCount

public CosmosRequestOptions setMaxPrefetchPageCount(Integer maxPrefetchPageCount)

Sets the MaxPrefetchPageCount.

Parameters:

maxPrefetchPageCount - the MaxPrefetchPageCount.

Returns:

current CosmosRequestOptions.

setNonIdempotentWriteRetriesEnabled

public CosmosRequestOptions setNonIdempotentWriteRetriesEnabled(Boolean nonIdempotentWriteRetriesEnabled)

Sets the NonIdempotentWriteRetriesEnabled.

Parameters:

nonIdempotentWriteRetriesEnabled - the NonIdempotentWriteRetriesEnabled.

Returns:

current CosmosRequestOptions.

setQueryAdviceEnabled

public CosmosRequestOptions setQueryAdviceEnabled(Boolean queryAdviceEnabled)

Sets queryAdviceEnabled, which is used to obtain query advice to understand aspects of the query that can be optimized.

Parameters:

queryAdviceEnabled - the queryAdviceEnabled flag.

Returns:

current CosmosRequestOptions.

setQueryMetricsEnabled

public CosmosRequestOptions setQueryMetricsEnabled(Boolean queryMetricsEnabled)

Sets the QueryMetricsEnabled.

Parameters:

queryMetricsEnabled - the QueryMetricsEnabled.

Returns:

current CosmosRequestOptions.

setQueryName

public CosmosRequestOptions setQueryName(String queryName)

Sets the QueryName.

Parameters:

queryName - the QueryName.

Returns:

current CosmosRequestOptions.

setReadConsistencyStrategy

public CosmosRequestOptions setReadConsistencyStrategy(ReadConsistencyStrategy readConsistencyStrategy)

Sets the read consistency strategy.

Parameters:

readConsistencyStrategy - the read consistency strategy.

Returns:

current CosmosRequestOptions.

setResponseContinuationTokenLimitInKb

public CosmosRequestOptions setResponseContinuationTokenLimitInKb(Integer responseContinuationTokenLimitInKb)

Sets the ResponseContinuationTokenLimitInKb.

Parameters:

responseContinuationTokenLimitInKb - the ResponseContinuationTokenLimitInKb.

Returns:

current CosmosRequestOptions.

setScanInQueryEnabled

public CosmosRequestOptions setScanInQueryEnabled(Boolean scanInQueryEnabled)

Sets the ScanInQueryEnabled.

Parameters:

scanInQueryEnabled - the ScanInQueryEnabled.

Returns:

current CosmosRequestOptions.

setThroughputControlGroupName

public CosmosRequestOptions setThroughputControlGroupName(String throughputControlGroupName)

Sets the throughput control group name.

Parameters:

throughputControlGroupName - the ThroughputControlGroupName.

Returns:

current CosmosRequestOptions.

Applies to