CosmosBatchRequestOptions Class
- java.
lang. Object - com.
azure. cosmos. models. CosmosBatchRequestOptions
- com.
public final class CosmosBatchRequestOptions
Encapsulates options that can be specified for a CosmosBatch.
Constructor Summary
| Constructor | Description |
|---|---|
| CosmosBatchRequestOptions() |
Creates an instance of the Cosmos |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
Map<Cosmos |
getAdditionalHeaders()
Gets the additional headers configured on this request options instance. |
|
Cosmos |
getCustomItemSerializer()
Gets the custom item serializer defined for this instance of request options |
|
Cosmos |
getDiagnosticsThresholds()
Gets the diagnostic thresholds used as an override for a specific operation. |
| List<String> |
getExcludedRegions()
Gets the list of regions to be excluded for the request/retries. |
| Set<String> |
getKeywordIdentifiers()
Gets the custom ids. |
| String |
getSessionToken()
Gets the token for use with session consistency. |
|
Cosmos |
setAdditionalHeaders(Map<CosmosAdditionalHeaderName,String> additionalHeaders)
Sets additional headers to be included with this specific request. |
|
Cosmos |
setCustomItemSerializer(CosmosItemSerializer customItemSerializer)
Allows specifying a custom item serializer to be used for this operation. |
|
Cosmos |
setDiagnosticsThresholds(CosmosDiagnosticsThresholds operationSpecificThresholds)
Allows overriding the diagnostic thresholds for a specific operation. |
|
Cosmos |
setExcludedRegions(List<String> excludeRegions)
List of regions to be excluded for the request/retries. |
|
Cosmos |
setKeywordIdentifiers(Set<String> keywordIdentifiers)
Sets the custom ids. |
|
Cosmos |
setSessionToken(String sessionToken)
Sets the token for use with session consistency. |
Methods inherited from java.lang.Object
Constructor Details
CosmosBatchRequestOptions
public CosmosBatchRequestOptions()
Creates an instance of the CosmosBatchRequestOptions class
Method Details
getAdditionalHeaders
public Map<CosmosAdditionalHeaderName,String> getAdditionalHeaders()
Gets the additional headers configured on this request options instance.
Returns:
null if none are setgetCustomItemSerializer
public CosmosItemSerializer getCustomItemSerializer()
Gets the custom item serializer defined for this instance of request options
Returns:
getDiagnosticsThresholds
public CosmosDiagnosticsThresholds getDiagnosticsThresholds()
Gets the diagnostic thresholds used as an override for a specific operation. If no operation specific diagnostic threshold has been specified, this method will return null, although at runtime the default thresholds specified at the client-level will be used.
Returns:
getExcludedRegions
public List<String> getExcludedRegions()
Gets the list of regions to be excluded for the request/retries. These regions are excluded from the preferred region list.
Returns:
getKeywordIdentifiers
public Set<String> getKeywordIdentifiers()
Gets the custom ids.
Returns:
getSessionToken
public String getSessionToken()
Gets the token for use with session consistency.
Returns:
setAdditionalHeaders
public CosmosBatchRequestOptions 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:
setCustomItemSerializer
public CosmosBatchRequestOptions setCustomItemSerializer(CosmosItemSerializer customItemSerializer)
Allows specifying a custom item serializer to be used for this operation. If the serializer on the request options is null, the serializer on CosmosClientBuilder is used. If both serializers are null (the default), an internal Jackson ObjectMapper is ued for serialization/deserialization.
Parameters:
Returns:
setDiagnosticsThresholds
public CosmosBatchRequestOptions setDiagnosticsThresholds(CosmosDiagnosticsThresholds operationSpecificThresholds)
Allows overriding the diagnostic thresholds for a specific operation.
Parameters:
Returns:
setExcludedRegions
public CosmosBatchRequestOptions setExcludedRegions(List<String> excludeRegions)
List of regions to be excluded for the request/retries. Example "East US" or "East US, West US" These regions will be excluded from the preferred regions list. 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:
Returns:
setKeywordIdentifiers
public CosmosBatchRequestOptions setKeywordIdentifiers(Set<String> keywordIdentifiers)
Sets the custom ids.
Parameters:
Returns:
setSessionToken
public CosmosBatchRequestOptions setSessionToken(String sessionToken)
Sets the token for use with session consistency.
Parameters:
Returns: