CosmosReadManyByPartitionKeysRequestOptions Class
- java.
lang. Object - com.
azure. cosmos. models. CosmosReadManyByPartitionKeysRequestOptions
- com.
public final class CosmosReadManyByPartitionKeysRequestOptions
Specifies the options associated with the readManyByPartitionKeys operation in the Azure Cosmos DB database service.
This is distinct from CosmosReadManyRequestOptions (used by the readMany(List<CosmosItemIdentity>) API). It exposes only the knobs that are applicable to readManyByPartitionKeys — for example, properties that influence query parallelism inside a single physical partition or a feed range filter are intentionally not exposed because the operation is fully managed by the SDK.
Constructor Summary
| Constructor | Description |
|---|---|
| CosmosReadManyByPartitionKeysRequestOptions() |
Instantiates a new read |
Method Summary
Methods inherited from java.lang.Object
Constructor Details
CosmosReadManyByPartitionKeysRequestOptions
public CosmosReadManyByPartitionKeysRequestOptions()
Instantiates a new readManyByPartitionKeys request options.
Method Details
getAdditionalHeaders
public Map<CosmosAdditionalHeaderName,String> getAdditionalHeaders()
Gets the additional headers configured on this request options instance.
Returns:
null if none are setgetContinuationToken
public String getContinuationToken()
Gets the composite continuation token used to resume a previous readManyByPartitionKeys invocation.
Returns:
getCustomItemSerializer
public CosmosItemSerializer getCustomItemSerializer()
Gets the custom item serializer defined for this instance of request options.
Returns:
getDedicatedGatewayRequestOptions
public DedicatedGatewayRequestOptions getDedicatedGatewayRequestOptions()
Gets the dedicated gateway request options.
Returns:
getDiagnosticsThresholds
public CosmosDiagnosticsThresholds getDiagnosticsThresholds()
Gets the diagnostic thresholds used as an override for a specific operation.
Returns:
getExcludedRegions
public List<String> getExcludedRegions()
Gets the list of regions to exclude for the request/retries.
Returns:
getKeywordIdentifiers
public Set<String> getKeywordIdentifiers()
Gets the custom keyword identifiers.
Returns:
getMaxBackendContinuationTokenSizeInKb
public int getMaxBackendContinuationTokenSizeInKb()
Gets the maximum size (in kilobytes) of the backend continuation token embedded inside the composite readManyByPartitionKeys continuation token. Returns 0 if not set.
Returns:
getMaxBatchSize
public Integer getMaxBatchSize()
Gets the maximum number of partition key values per batch query sent to a single physical partition. Returns null if not set, in which case the SDK default is used (currently 100, configurable globally via the system property or environment variable COSMOS.READ_MANY_BY_PK_MAX_BATCH_SIZE).
Returns:
getMaxConcurrentBatchPrefetch
public Integer getMaxConcurrentBatchPrefetch()
Gets the maximum number of per-physical-partition batches whose first page is prefetched concurrently. This bounds the prefetch parallelism the SDK uses while sequentially draining batches.
Returns:
getMaxItemCount
public Integer getMaxItemCount()
Gets the maximum number of items returned in a single page.
Returns:
getReadConsistencyStrategy
public ReadConsistencyStrategy getReadConsistencyStrategy()
Gets the read consistency strategy for the request.
Returns:
getSessionToken
public String getSessionToken()
Gets the session token for use with session consistency.
Returns:
getThresholdForDiagnosticsOnTracer
public Duration getThresholdForDiagnosticsOnTracer()
Gets the latency threshold for diagnostics on tracer.
Returns:
getThroughputControlGroupName
public String getThroughputControlGroupName()
Gets the throughput control group name.
Returns:
isQueryMetricsEnabled
public boolean isQueryMetricsEnabled()
Gets the option to enable populate query metrics. By default query metrics are enabled.
Returns:
setAdditionalHeaders
public CosmosReadManyByPartitionKeysRequestOptions setAdditionalHeaders(Map<CosmosAdditionalHeaderName,String> additionalHeaders)
Sets additional headers to be included with this specific request.
The CosmosAdditionalHeaderName class defines exactly which headers are supported. This allows per-request header customization, such as setting a workload ID that overrides the client-level default set via com.azure.cosmos.CosmosClientBuilder#additionalHeaders(java.util.Map).
If the same header is also set at the client level, the request-level value takes precedence.
Note: This method uses additive (merge) semantics — headers from multiple calls are merged into the existing set. Passing null or an empty map does not clear previously set headers. To reset headers, create a new options instance.
Parameters:
Returns:
setContinuationToken
public CosmosReadManyByPartitionKeysRequestOptions setContinuationToken(String continuationToken)
Sets the composite continuation token used to resume a previous readManyByPartitionKeys invocation. The token must have been returned by a prior invocation of readManyByPartitionKeys on the same container, with the same partition-key set and the same custom query.
Parameters:
Returns:
setCosmosEndToEndOperationLatencyPolicyConfig
public CosmosReadManyByPartitionKeysRequestOptions setCosmosEndToEndOperationLatencyPolicyConfig(CosmosEndToEndOperationLatencyPolicyConfig cosmosEndToEndOperationLatencyPolicyConfig)
Sets the CosmosEndToEndOperationLatencyPolicyConfig to be used for the request.
Parameters:
Returns:
setCustomItemSerializer
public CosmosReadManyByPartitionKeysRequestOptions setCustomItemSerializer(CosmosItemSerializer customItemSerializer)
Sets a custom item serializer to be used for this operation.
Parameters:
Returns:
setDedicatedGatewayRequestOptions
public CosmosReadManyByPartitionKeysRequestOptions setDedicatedGatewayRequestOptions(DedicatedGatewayRequestOptions dedicatedGatewayRequestOptions)
Sets the dedicated gateway request options.
Parameters:
Returns:
setDiagnosticsThresholds
public CosmosReadManyByPartitionKeysRequestOptions setDiagnosticsThresholds(CosmosDiagnosticsThresholds operationSpecificThresholds)
Allows overriding the diagnostic thresholds for a specific operation.
Parameters:
Returns:
setExcludedRegions
public CosmosReadManyByPartitionKeysRequestOptions setExcludedRegions(List<String> excludeRegions)
List of regions to be excluded for the request/retries.
Parameters:
Returns:
setKeywordIdentifiers
public CosmosReadManyByPartitionKeysRequestOptions setKeywordIdentifiers(Set<String> keywordIdentifiers)
Sets the custom keyword identifiers.
Parameters:
Returns:
setMaxBackendContinuationTokenSizeInKb
public CosmosReadManyByPartitionKeysRequestOptions setMaxBackendContinuationTokenSizeInKb(int limitInKb)
Sets the maximum size (in kilobytes) of the backend continuation token embedded inside the composite readManyByPartitionKeys continuation token.
Note: this only constrains the per-batch backend continuation that the SDK wraps inside the public composite token; the public composite token itself is always larger because it also carries the remaining batch definitions, query hash, and partition-key-set hash.
Parameters:
Returns:
setMaxBatchSize
public CosmosReadManyByPartitionKeysRequestOptions setMaxBatchSize(int maxBatchSize)
Sets the maximum number of partition key values per batch query sent to a single physical partition. The default is 100 (overridable globally via the system property COSMOS.READ_MANY_BY_PK_MAX_BATCH_SIZE). This per-request setting takes precedence over the global default.
Increasing this value reduces the number of batches (and round-trips) but produces larger IN-clause queries that consume more RUs per request. Decreasing it increases the number of batches but keeps individual requests lighter.
Parameters:
Returns:
setMaxConcurrentBatchPrefetch
public CosmosReadManyByPartitionKeysRequestOptions setMaxConcurrentBatchPrefetch(int maxConcurrentBatchPrefetch)
Sets the maximum number of per-physical-partition batches whose first page is prefetched concurrently. The default is Math.max(1, Math.min(Runtime.getRuntime().availableProcessors(), 8)).
Increase this to trade memory for lower end-to-end latency on wide containers; decrease it (e.g. to 1) when running in environments where a single task already saturates the network/CPU and additional prefetch only adds memory pressure.
Parameters:
Returns:
setMaxItemCount
public CosmosReadManyByPartitionKeysRequestOptions setMaxItemCount(int maxItemCount)
Sets the maximum number of items returned in a single page.
Parameters:
Returns:
setQueryMetricsEnabled
public CosmosReadManyByPartitionKeysRequestOptions setQueryMetricsEnabled(boolean queryMetricsEnabled)
Sets the option to enable/disable query metrics.
Parameters:
Returns:
setReadConsistencyStrategy
public CosmosReadManyByPartitionKeysRequestOptions setReadConsistencyStrategy(ReadConsistencyStrategy readConsistencyStrategy)
Sets the read consistency strategy required for the request.
Parameters:
Returns:
setSessionToken
public CosmosReadManyByPartitionKeysRequestOptions setSessionToken(String sessionToken)
Sets the session token for use with session consistency.
Parameters:
Returns:
setThresholdForDiagnosticsOnTracer
public CosmosReadManyByPartitionKeysRequestOptions setThresholdForDiagnosticsOnTracer(Duration thresholdForDiagnosticsOnTracer)
Sets the latency threshold for diagnostics on tracer.
Parameters:
Returns:
setThroughputControlGroupName
public CosmosReadManyByPartitionKeysRequestOptions setThroughputControlGroupName(String throughputControlGroupName)
Sets the throughput control group name.
Parameters:
Returns: