Class CosmosChangeFeedRequestOptions
-
Method Summary
Modifier and TypeMethodDescriptionChanges the change feed mode so that the change feed will contain events for creations, deletes as well as all intermediary snapshots for updates.createForProcessingFromBeginning
(FeedRange feedRange) Creates a newCosmosChangeFeedRequestOptions
instance to start processing change feed items from the beginning of the change feedcreateForProcessingFromContinuation
(String continuation) Creates a newCosmosChangeFeedRequestOptions
instance to start processing change feed items from a previous continuationcreateForProcessingFromNow
(FeedRange feedRange) Creates a newCosmosChangeFeedRequestOptions
instance to start processing change feed items from the current time - so only events for all future changes will be retrievedcreateForProcessingFromPointInTime
(Instant pointInTime, FeedRange feedRange) Creates a newCosmosChangeFeedRequestOptions
instance to start processing change feed items from a certain point in timeDeprecated.Gets the custom item serializer defined for this instance of request optionsGets the diagnostic thresholds used as an override for a specific operation.Gets the list of regions to be excluded for the request/retries.Gets the feed range.Gets the custom ids.int
Gets the maximum number of items to be returned in the enumeration operation.int
Gets the maximum number of pages that will be prefetched from the backend asynchronously in the background.Get the throughput control group name.boolean
Whether the query should be completed when all available changes when the query starts have been fetched.boolean
Gets the quotaInfoEnabled setting for change feed request in the Azure Cosmos DB database service.setCompleteAfterAllCurrentChangesRetrieved
(boolean completeAfterAllCurrentChangesRetrieved) Whether the query should be completed when all available changes when the query starts have been fetched.setCustomItemSerializer
(CosmosItemSerializer customItemSerializer) Allows specifying a custom item serializer to be used for this operation.setDiagnosticsThresholds
(CosmosDiagnosticsThresholds operationSpecificThresholds) Allows overriding the diagnostic thresholds for a specific operation.setExcludedRegions
(List<String> excludeRegions) List of regions to exclude for the request/retries.setKeywordIdentifiers
(Set<String> keywordIdentifiers) Sets the custom ids.setMaxItemCount
(int maxItemCount) Sets the maximum number of items to be returned in the enumeration operation.setMaxPrefetchPageCount
(int maxPrefetchPageCount) Sets the maximum number of pages that will be prefetched from the backend asynchronously in the background.void
setQuotaInfoEnabled
(boolean quotaInfoEnabled) Gets the quotaInfoEnabled setting for change feed request in the Azure Cosmos DB database service.setThroughputControlGroupName
(String throughputControlGroupName) Set the throughput control group name.
-
Method Details
-
getFeedRange
Gets the feed range.- Returns:
- the feed range.
-
getMaxItemCount
public int getMaxItemCount()Gets the maximum number of items to be returned in the enumeration operation.- Returns:
- the max number of items.
-
setMaxItemCount
Sets the maximum number of items to be returned in the enumeration operation.- Parameters:
maxItemCount
- the max number of items.- Returns:
- the FeedOptionsBase.
-
getMaxPrefetchPageCount
public int getMaxPrefetchPageCount()Gets the maximum number of pages that will be prefetched from the backend asynchronously in the background. By pre-fetching these changes the throughput of processing the change feed records can be increased because the processing doesn't have to stop while waiting for the IO operations to retrieve a new page form the backend to complete. The only scenario where it can be useful to disable prefetching pages (with setMaxPrefetchPageCount(0)) would be when the caller only plans to retrieve just one page - so any prefetched pages would not be used anyway.- Returns:
- the modified change feed request options.
-
setMaxPrefetchPageCount
Sets the maximum number of pages that will be prefetched from the backend asynchronously in the background. By pre-fetching these changes the throughput of processing the change feed records can be increased because the processing doesn't have to stop while waiting for the IO operations to retrieve a new page form the backend to complete. The only scenario where it can be useful to disable prefetching pages (with setMaxPrefetchPageCount(0)) would be when the caller only plans to retrieve just one page - so any prefetched pages would not be used anyway.- Parameters:
maxPrefetchPageCount
- the max number of pages that will be prefetched from the backend asynchronously in the background- Returns:
- the modified change feed request options.
-
isQuotaInfoEnabled
public boolean isQuotaInfoEnabled()Gets the quotaInfoEnabled setting for change feed request in the Azure Cosmos DB database service. quotaInfoEnabled is used to enable/disable getting quota related stats- Returns:
- true if quotaInfoEnabled is enabled
-
setQuotaInfoEnabled
public void setQuotaInfoEnabled(boolean quotaInfoEnabled) Gets the quotaInfoEnabled setting for change feed request in the Azure Cosmos DB database service. quotaInfoEnabled is used to enable/disable getting quota related stats- Parameters:
quotaInfoEnabled
- a boolean value indicating whether quotaInfoEnabled is enabled or not
-
setDiagnosticsThresholds
public CosmosChangeFeedRequestOptions setDiagnosticsThresholds(CosmosDiagnosticsThresholds operationSpecificThresholds) Allows overriding the diagnostic thresholds for a specific operation.- Parameters:
operationSpecificThresholds
- the diagnostic threshold override for this operation- Returns:
- the CosmosQueryRequestOptions.
-
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:
- the diagnostic thresholds used as an override for a specific operation.
-
getCustomItemSerializer
Gets the custom item serializer defined for this instance of request options- Returns:
- the custom item serializer
-
setCustomItemSerializer
public CosmosChangeFeedRequestOptions 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:
customItemSerializer
- the custom item serializer for this operation- Returns:
- the CosmosChangeFeedRequestOptions.
-
setCompleteAfterAllCurrentChangesRetrieved
public CosmosChangeFeedRequestOptions setCompleteAfterAllCurrentChangesRetrieved(boolean completeAfterAllCurrentChangesRetrieved) Whether the query should be completed when all available changes when the query starts have been fetched.- Parameters:
completeAfterAllCurrentChangesRetrieved
- flag to indicate whether to complete the query when all changes up to current moment have been fetched.- Returns:
- the CosmosChangeFeedRequestOptions.
-
isCompleteAfterAllCurrentChangesRetrieved
public boolean isCompleteAfterAllCurrentChangesRetrieved()Whether the query should be completed when all available changes when the query starts have been fetched.- Returns:
- true if complete the query when all changes up to the current moment have been fetched.
-
createForProcessingFromBeginning
Creates a newCosmosChangeFeedRequestOptions
instance to start processing change feed items from the beginning of the change feed- Parameters:
feedRange
- TheFeedRange
that is used to define the scope (entire container, logical partition or subset of a container)- Returns:
- a new
CosmosChangeFeedRequestOptions
instance
-
createForProcessingFromContinuation
public static CosmosChangeFeedRequestOptions createForProcessingFromContinuation(String continuation) Creates a newCosmosChangeFeedRequestOptions
instance to start processing change feed items from a previous continuation- Parameters:
continuation
- The continuation that was retrieved from a previously retrieved FeedResponse- Returns:
- a new
CosmosChangeFeedRequestOptions
instance
-
createForProcessingFromNow
Creates a newCosmosChangeFeedRequestOptions
instance to start processing change feed items from the current time - so only events for all future changes will be retrieved- Parameters:
feedRange
- TheFeedRange
that is used to define the scope (entire container, logical partition or subset of a container)- Returns:
- a new
CosmosChangeFeedRequestOptions
instance
-
createForProcessingFromPointInTime
public static CosmosChangeFeedRequestOptions createForProcessingFromPointInTime(Instant pointInTime, FeedRange feedRange) Creates a newCosmosChangeFeedRequestOptions
instance to start processing change feed items from a certain point in time- Parameters:
pointInTime
- The point in time from which processing of change feed events should startfeedRange
- TheFeedRange
that is used to define the scope (entire container, logical partition or subset of a container)- Returns:
- a new
CosmosChangeFeedRequestOptions
instance
-
fullFidelity
@Beta(value=V4_12_0, warningText="Preview API - subject to change in non-backwards compatible way") @Deprecated public CosmosChangeFeedRequestOptions fullFidelity()Deprecated.useallVersionsAndDeletes()
instead.Changes the change feed mode so that the change feed will contain events for creations, deletes as well as all intermediary snapshots for updates. Enabling AllVersionsAndDeletes change feed mode requires configuring a retention duration in the change feed policy of the container.ChangeFeedPolicy
Intermediary snapshots of changes as well as deleted documents would be available for processing for retention window before they vanish. When enabling AllVersionsAndDeletes mode you will only be able to process change feed events within the retention window configured in the change feed policy of the container. If you attempt to process a change feed after more than the retention window an error (Status Code 400) will be returned because the events for intermediary updates and deletes have vanished. It would still be possible to process changes using LatestVersion mode even when configuring a AllVersionsAndDeletes change feed policy with retention window on the container and when using LatestVersion mode it doesn't matter whether your are out of the retention window or not - but no events for deletes or intermediary updates would be included. When events are not getting processed within the retention window it is also possible to continue processing future events in AllVersionsAndDeletes mode by querying the change feed with a new CosmosChangeFeedRequestOptions instance.
- Returns:
- a
CosmosChangeFeedRequestOptions
instance with AllVersionsAndDeletes mode enabled
-
allVersionsAndDeletes
@Beta(value=V4_37_0, warningText="Preview API - subject to change in non-backwards compatible way") public CosmosChangeFeedRequestOptions allVersionsAndDeletes()Changes the change feed mode so that the change feed will contain events for creations, deletes as well as all intermediary snapshots for updates. Enabling AllVersionsAndDeletes change feed mode requires configuring a retention duration in the change feed policy of the container.ChangeFeedPolicy
Intermediary snapshots of changes as well as deleted documents would be available for processing for 8 minutes before they vanish. When enabling AllVersionsAndDeletes mode you will only be able to process change feed events within the retention window configured in the change feed policy of the container. If you attempt to process a change feed after more than the retention window an error (Status Code 400) will be returned because the events for intermediary updates and deletes have vanished. It would still be possible to process changes using LatestVersion mode even when configuring a AllVersionsAndDeletes change feed policy with retention window on the container and when using LatestVersion mode it doesn't matter whether your are out of the retention window or not - but no events for deletes or intermediary updates would be included. When events are not getting processed within the retention window it is also possible to continue processing future events in AllVersionsAndDeletes mode by querying the change feed with a new CosmosChangeFeedRequestOptions instance.
- Returns:
- a
CosmosChangeFeedRequestOptions
instance with AllVersionsAndDeletes mode enabled
-
getThroughputControlGroupName
Get the throughput control group name.- Returns:
- The throughput control group name.
-
setThroughputControlGroupName
public CosmosChangeFeedRequestOptions setThroughputControlGroupName(String throughputControlGroupName) Set the throughput control group name.- Parameters:
throughputControlGroupName
- The throughput control group name.- Returns:
- A
CosmosChangeFeedRequestOptions
.
-
setExcludedRegions
List of regions to exclude for the request/retries. Example "East US" or "East US, West US" These regions will be excluded from the preferred regions list- Parameters:
excludeRegions
- list of regions- Returns:
- the
CosmosChangeFeedRequestOptions
-
getExcludedRegions
Gets the list of regions to be excluded for the request/retries. These regions are excluded from the preferred region list.- Returns:
- a list of excluded regions
-
setKeywordIdentifiers
Sets the custom ids.- Parameters:
keywordIdentifiers
- the custom ids.- Returns:
- the current request options.
-
getKeywordIdentifiers
Gets the custom ids.- Returns:
- the custom ids.
-
allVersionsAndDeletes()
instead.