Class ChangeFeedProcessorOptions
ChangeFeedProcessor
.-
Field Summary
-
Constructor Summary
ConstructorDescriptionInstantiates a new Change feed processor options. -
Method Summary
Modifier and TypeMethodDescriptionGets the delay in between polling a partition for new changes on the feed, after all current changes are drained.Get the feed pool throughput control config.Gets the interval to kick off a task to compute if partitions are distributed evenly among known host instances.Gets the interval for which the lease is taken on a lease representing a partition.Gets a prefix to be used as part of the lease ID.Gets the renew interval for all leases for partitions currently held byChangeFeedProcessor
instance.int
Gets the maximum number of items to be returned in the enumeration operation in the Azure Cosmos DB service.int
Gets the maximum number of partitions (parallel workers) the host can run.int
Gets the minimum partition count (parallel workers) for the current host.Gets the internalScheduler
that hosts a pool of ExecutorService-based workers for any change feed processor related tasks.Gets the start request continuation token to start looking for changes after.Gets the time (exclusive) to start looking for changes after.boolean
Gets a value indicating whether change feed in the Azure Cosmos DB service should start from beginning (true) or from current (false).setFeedPollDelay
(Duration feedPollDelay) Sets the delay in between polling a partition for new changes on the feed, after all current changes are drained.setFeedPollThroughputControlConfig
(ThroughputControlGroupConfig feedPollThroughputControlGroupConfig) Set the feed poll local throughput control config.setLeaseAcquireInterval
(Duration leaseAcquireInterval) Sets he interval to kick off a task to compute if partitions are distributed evenly among known host instances.setLeaseExpirationInterval
(Duration leaseExpirationInterval) Sets the interval for which the lease is taken on a lease representing a partition.setLeasePrefix
(String leasePrefix) Sets a prefix to be used as part of the lease ID.setLeaseRenewInterval
(Duration leaseRenewInterval) Sets the renew interval for all leases for partitions currently held byChangeFeedProcessor
instance.setMaxItemCount
(int maxItemCount) Sets the maximum number of items to be returned in the enumeration operation.setMaxScaleCount
(int maxScaleCount) Sets the maximum number of partitions (parallel workers) the host can run.setMinScaleCount
(int minScaleCount) Sets the minimum partition count (parallel workers) for the current host.setScheduler
(Scheduler scheduler) Sets the internalScheduler
that hosts a pool of ExecutorService-based workers for any change feed processor related tasks.setStartContinuation
(String startContinuation) Sets the start request continuation token to start looking for changes after.setStartFromBeginning
(boolean startFromBeginning) Sets a value indicating whether change feed in the Azure Cosmos DB service should start from beginning.setStartTime
(Instant startTime) Sets the time (exclusive) to start looking for changes after (UTC time).
-
Field Details
-
DEFAULT_RENEW_INTERVAL
Default renew interval. -
DEFAULT_ACQUIRE_INTERVAL
Default acquire interval. -
DEFAULT_EXPIRATION_INTERVAL
Default expiration interval. -
DEFAULT_FEED_POLL_DELAY
Default feed poll delay.
-
-
Constructor Details
-
ChangeFeedProcessorOptions
public ChangeFeedProcessorOptions()Instantiates a new Change feed processor options.
-
-
Method Details
-
getLeaseRenewInterval
Gets the renew interval for all leases for partitions currently held byChangeFeedProcessor
instance.- Returns:
- the renew interval for all leases for partitions.
-
setLeaseRenewInterval
Sets the renew interval for all leases for partitions currently held byChangeFeedProcessor
instance.- Parameters:
leaseRenewInterval
- the renew interval for all leases for partitions currently held byChangeFeedProcessor
instance.- Returns:
- the current ChangeFeedProcessorOptions instance.
-
getLeaseAcquireInterval
Gets the interval to kick off a task to compute if partitions are distributed evenly among known host instances.- Returns:
- the interval to kick off a task to compute if partitions are distributed evenly among known host instances.
-
setLeaseAcquireInterval
Sets he interval to kick off a task to compute if partitions are distributed evenly among known host instances.- Parameters:
leaseAcquireInterval
- he interval to kick off a task to compute if partitions are distributed evenly among known host instances.- Returns:
- the current ChangeFeedProcessorOptions instance.
-
getLeaseExpirationInterval
Gets the interval for which the lease is taken on a lease representing a partition.If the lease is not renewed within this interval, it will cause it to expire and ownership of the partition will move to another
ChangeFeedProcessor
instance.- Returns:
- the interval for which the lease is taken on a lease representing a partition.
-
setLeaseExpirationInterval
Sets the interval for which the lease is taken on a lease representing a partition.If the lease is not renewed within this interval, it will cause it to expire and ownership of the partition will move to another
ChangeFeedProcessor
instance.- Parameters:
leaseExpirationInterval
- the interval for which the lease is taken on a lease representing a partition.- Returns:
- the current ChangeFeedProcessorOptions instance.
-
getFeedPollDelay
Gets the delay in between polling a partition for new changes on the feed, after all current changes are drained.- Returns:
- the delay in between polling a partition for new changes on the feed.
-
setFeedPollDelay
Sets the delay in between polling a partition for new changes on the feed, after all current changes are drained.- Parameters:
feedPollDelay
- the delay in between polling a partition for new changes on the feed, after all current changes are drained.- Returns:
- the current ChangeFeedProcessorOptions instance.
-
getLeasePrefix
Gets a prefix to be used as part of the lease ID.This can be used to support multiple instances of
ChangeFeedProcessor
instances pointing at the same feed while using the same auxiliary container.- Returns:
- a prefix to be used as part of the lease ID.
-
setLeasePrefix
Sets a prefix to be used as part of the lease ID.- Parameters:
leasePrefix
- a prefix to be used as part of the lease ID.- Returns:
- the current ChangeFeedProcessorOptions instance.
-
getMaxItemCount
public int getMaxItemCount()Gets the maximum number of items to be returned in the enumeration operation in the Azure Cosmos DB service.- Returns:
- the maximum number of items to be returned in the enumeration operation in the Azure Cosmos DB service.
-
setMaxItemCount
Sets the maximum number of items to be returned in the enumeration operation.NOTE: There are some cases where the number of items returned from the Change Feed can be higher than the specified value. If items in the container are being written through stored procedures, transactional batch, or bulk, they share the same transaction and the same bookkeeping, so they will be returned together when read through the Change Feed.
- Parameters:
maxItemCount
- the maximum number of items to be returned in the enumeration operation.- Returns:
- the current ChangeFeedProcessorOptions instance.
-
getStartContinuation
Gets the start request continuation token to start looking for changes after.This option can be used when lease store is not initialized and it is ignored if a lease item exists and has continuation token that is not null. If this is specified, both StartTime and StartFromBeginning are ignored.
- Returns:
- the string representing a continuation token that will be used to get item feeds starting with.
-
setStartContinuation
Sets the start request continuation token to start looking for changes after.This option can be used when lease store is not initialized and it is ignored if a lease item exists and has continuation token that is not null. If this is specified, both StartTime and StartFromBeginning are ignored.
- Parameters:
startContinuation
- the start request continuation token to start looking for changes after.- Returns:
- the string representing a continuation token that will be used to get item feeds starting with.
-
getStartTime
Gets the time (exclusive) to start looking for changes after.This option can be used when: (1) Lease items are not initialized; this setting will be ignored if the lease items exists and have a valid continuation token. (2) Start continuation token option is not specified. If this option is specified, "start from beginning" option is ignored.
- Returns:
- the time (exclusive) to start looking for changes after.
-
setStartTime
Sets the time (exclusive) to start looking for changes after (UTC time).This option can be used when: (1) Lease items are not initialized; this setting will be ignored if the lease items exists and have a valid continuation token. (2) Start continuation token option is not specified. If this option is specified, "start from beginning" option is ignored.
- Parameters:
startTime
- the time (exclusive) to start looking for changes after.- Returns:
- the current ChangeFeedProcessorOptions instance.
-
isStartFromBeginning
public boolean isStartFromBeginning()Gets a value indicating whether change feed in the Azure Cosmos DB service should start from beginning (true) or from current (false). By default it's start from current (false).This option can be used when: (1) Lease items are not initialized; this setting will be ignored if the lease items exists and have a valid continuation token. (2) Start continuation token option is not specified. (3) Start time option is not specified.
- Returns:
- a value indicating whether change feed in the Azure Cosmos DB service should start from.
-
setStartFromBeginning
Sets a value indicating whether change feed in the Azure Cosmos DB service should start from beginning.This option can be used when: (1) Lease items are not initialized; this setting will be ignored if the lease items exists and have a valid continuation token. (2) Start continuation token option is not specified. (3) Start time option is not specified.
- Parameters:
startFromBeginning
- Indicates to start from beginning if true- Returns:
- the current ChangeFeedProcessorOptions instance.
-
getMinScaleCount
public int getMinScaleCount()Gets the minimum partition count (parallel workers) for the current host.This option can be used to increase the number of partitions (parallel workers) for the host and thus override the default equal distribution of leases between multiple hosts.
- Returns:
- the minimum scale count for the host.
-
setMinScaleCount
Sets the minimum partition count (parallel workers) for the current host.This option can be used to increase the number of partitions (parallel workers) for the host and thus override the default equal distribution of leases between multiple hosts.
- Parameters:
minScaleCount
- the minimum partition count for the host.- Returns:
- the current ChangeFeedProcessorOptions instance.
-
getMaxScaleCount
public int getMaxScaleCount()Gets the maximum number of partitions (parallel workers) the host can run.This option can be used to limit the number of partitions (parallel workers) for the host and thus override the default equal distribution of leases between multiple hosts. Default setting is "0", unlimited.
- Returns:
- the maximum number of partitions (parallel workers) the host can run.
-
setMaxScaleCount
Sets the maximum number of partitions (parallel workers) the host can run.This option can be used to limit the number of partitions (parallel workers) for the host and thus override the default equal distribution of leases between multiple hosts. Default setting is "0", unlimited.
- Parameters:
maxScaleCount
- the maximum number of partitions (parallel workers) the host can run.- Returns:
- the current ChangeFeedProcessorOptions instance.
-
getScheduler
Gets the internalScheduler
that hosts a pool of ExecutorService-based workers for any change feed processor related tasks.- Returns:
- a
Scheduler
that hosts a pool of ExecutorService-based workers..
-
setScheduler
Sets the internalScheduler
that hosts a pool of ExecutorService-based workers for any change feed processor related tasks.- Parameters:
scheduler
- aScheduler
that hosts a pool of ExecutorService-based workers.ChangeFeedProcessor
instance.- Returns:
- the current ChangeFeedProcessorOptions instance.
-
setFeedPollThroughputControlConfig
public ChangeFeedProcessorOptions setFeedPollThroughputControlConfig(ThroughputControlGroupConfig feedPollThroughputControlGroupConfig) Set the feed poll local throughput control config. Please use this config with caution. By default, CFP will try to process the changes as fast as possible, only use this config if you want to limit the RU that can be used for your change feed processing. By using this config, it can slow down the process and cause the lag. For direct mode, please configure the throughput control group with the total RU you would allow for changeFeed processing. For gateway mode, please configure the throughput control group with the total RU you would allow for changeFeed processing / total CFP Instances.- Parameters:
feedPollThroughputControlGroupConfig
- the throughput control for change feed requests for the monitored collection- Returns:
- the
ChangeFeedProcessorOptions
.
-
getFeedPollThroughputControlGroupConfig
Get the feed pool throughput control config.- Returns:
- the
ThroughputControlGroupConfig
.
-