ChangeFeedProcessorOptions Class
- java.
lang. Object - com.
azure. cosmos. models. ChangeFeedProcessorOptions
- com.
public final class ChangeFeedProcessorOptions
Specifies the options associated with ChangeFeedProcessor.
Field Summary
Modifier and Type | Field and Description |
---|---|
static final Duration |
DEFAULT_ACQUIRE_INTERVAL
Default acquire interval. |
static final Duration |
DEFAULT_EXPIRATION_INTERVAL
Default expiration interval. |
static final Duration |
DEFAULT_FEED_POLL_DELAY
Default feed poll delay. |
static final Duration |
DEFAULT_RENEW_INTERVAL
Default renew interval. |
Constructor Summary
Constructor | Description |
---|---|
ChangeFeedProcessorOptions() |
Instantiates a new Change feed processor options. |
Method Summary
Modifier and Type | Method and Description |
---|---|
Duration |
getFeedPollDelay()
Gets the delay in between polling a partition for new changes on the feed, after all current changes are drained. |
Throughput |
getFeedPollThroughputControlGroupConfig()
Get the feed pool throughput control config. |
Duration |
getLeaseAcquireInterval()
Gets the interval to kick off a task to compute if partitions are distributed evenly among known host instances. |
Duration |
getLeaseExpirationInterval()
Gets the interval for which the lease is taken on a lease representing a partition. |
String |
getLeasePrefix()
Gets a prefix to be used as part of the lease ID. |
Duration |
getLeaseRenewInterval()
Gets the renew interval for all leases for partitions currently held by ChangeFeedProcessor instance. |
int |
getMaxItemCount()
Gets the maximum number of items to be returned in the enumeration operation in the Azure Cosmos DB service. |
int |
getMaxScaleCount()
Gets the maximum number of partitions (parallel workers) the host can run. |
int |
getMinScaleCount()
Gets the minimum partition count (parallel workers) for the current host. |
Scheduler |
getScheduler()
Gets the internal Scheduler that hosts a pool of Executor |
String |
getStartContinuation()
Gets the start request continuation token to start looking for changes after. |
Instant |
getStartTime()
Gets the time (exclusive) to start looking for changes after. |
boolean |
isStartFromBeginning()
Gets a value indicating whether change feed in the Azure Cosmos DB service should start from beginning (true) or from current (false). |
Change |
setFeedPollDelay(Duration feedPollDelay)
Sets the delay in between polling a partition for new changes on the feed, after all current changes are drained. |
Change |
setFeedPollThroughputControlConfig(ThroughputControlGroupConfig feedPollThroughputControlGroupConfig)
Set the feed poll local throughput control config. |
Change |
setLeaseAcquireInterval(Duration leaseAcquireInterval)
Sets he interval to kick off a task to compute if partitions are distributed evenly among known host instances. |
Change |
setLeaseExpirationInterval(Duration leaseExpirationInterval)
Sets the interval for which the lease is taken on a lease representing a partition. |
Change |
setLeasePrefix(String leasePrefix)
Sets a prefix to be used as part of the lease ID. |
Change |
setLeaseRenewInterval(Duration leaseRenewInterval)
Sets the renew interval for all leases for partitions currently held by ChangeFeedProcessor instance. |
Change |
setMaxItemCount(int maxItemCount)
Sets the maximum number of items to be returned in the enumeration operation. |
Change |
setMaxScaleCount(int maxScaleCount)
Sets the maximum number of partitions (parallel workers) the host can run. |
Change |
setMinScaleCount(int minScaleCount)
Sets the minimum partition count (parallel workers) for the current host. |
Change |
setScheduler(Scheduler scheduler)
Sets the internal Scheduler that hosts a pool of Executor |
Change |
setStartContinuation(String startContinuation)
Sets the start request continuation token to start looking for changes after. |
Change |
setStartFromBeginning(boolean startFromBeginning)
Sets a value indicating whether change feed in the Azure Cosmos DB service should start from beginning. |
Change |
setStartTime(Instant startTime)
Sets the time (exclusive) to start looking for changes after (UTC time). |
Methods inherited from java.lang.Object
Field Details
DEFAULT_ACQUIRE_INTERVAL
public static final Duration DEFAULT_ACQUIRE_INTERVAL
Default acquire interval.
DEFAULT_EXPIRATION_INTERVAL
public static final Duration DEFAULT_EXPIRATION_INTERVAL
Default expiration interval.
DEFAULT_FEED_POLL_DELAY
public static final Duration DEFAULT_FEED_POLL_DELAY
Default feed poll delay.
DEFAULT_RENEW_INTERVAL
public static final Duration DEFAULT_RENEW_INTERVAL
Default renew interval.
Constructor Details
ChangeFeedProcessorOptions
public ChangeFeedProcessorOptions()
Instantiates a new Change feed processor options.
Method Details
getFeedPollDelay
public Duration getFeedPollDelay()
Gets the delay in between polling a partition for new changes on the feed, after all current changes are drained.
Returns:
getFeedPollThroughputControlGroupConfig
public ThroughputControlGroupConfig getFeedPollThroughputControlGroupConfig()
Get the feed pool throughput control config.
Returns:
getLeaseAcquireInterval
public Duration getLeaseAcquireInterval()
Gets the interval to kick off a task to compute if partitions are distributed evenly among known host instances.
Returns:
getLeaseExpirationInterval
public Duration 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:
getLeasePrefix
public String 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:
getLeaseRenewInterval
public Duration getLeaseRenewInterval()
Gets the renew interval for all leases for partitions currently held by ChangeFeedProcessor instance.
Returns:
getMaxItemCount
public int getMaxItemCount()
Gets the maximum number of items to be returned in the enumeration operation in the Azure Cosmos DB service.
Returns:
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:
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:
getScheduler
public Scheduler getScheduler()
Gets the internal Scheduler that hosts a pool of ExecutorService-based workers for any change feed processor related tasks.
Returns:
getStartContinuation
public String 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:
getStartTime
public Instant 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:
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:
setFeedPollDelay
public ChangeFeedProcessorOptions setFeedPollDelay(Duration feedPollDelay)
Sets the delay in between polling a partition for new changes on the feed, after all current changes are drained.
Parameters:
Returns:
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:
Returns:
setLeaseAcquireInterval
public ChangeFeedProcessorOptions setLeaseAcquireInterval(Duration leaseAcquireInterval)
Sets he interval to kick off a task to compute if partitions are distributed evenly among known host instances.
Parameters:
Returns:
setLeaseExpirationInterval
public ChangeFeedProcessorOptions setLeaseExpirationInterval(Duration leaseExpirationInterval)
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:
Returns:
setLeasePrefix
public ChangeFeedProcessorOptions setLeasePrefix(String leasePrefix)
Sets a prefix to be used as part of the lease ID.
Parameters:
Returns:
setLeaseRenewInterval
public ChangeFeedProcessorOptions setLeaseRenewInterval(Duration leaseRenewInterval)
Sets the renew interval for all leases for partitions currently held by ChangeFeedProcessor instance.
Parameters:
Returns:
setMaxItemCount
public ChangeFeedProcessorOptions setMaxItemCount(int maxItemCount)
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:
Returns:
setMaxScaleCount
public ChangeFeedProcessorOptions setMaxScaleCount(int maxScaleCount)
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:
Returns:
setMinScaleCount
public ChangeFeedProcessorOptions setMinScaleCount(int minScaleCount)
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:
Returns:
setScheduler
public ChangeFeedProcessorOptions setScheduler(Scheduler scheduler)
Sets the internal Scheduler that hosts a pool of ExecutorService-based workers for any change feed processor related tasks.
Parameters:
Returns:
setStartContinuation
public ChangeFeedProcessorOptions setStartContinuation(String startContinuation)
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:
Returns:
setStartFromBeginning
public ChangeFeedProcessorOptions setStartFromBeginning(boolean startFromBeginning)
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:
Returns:
setStartTime
public ChangeFeedProcessorOptions setStartTime(Instant startTime)
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:
Returns: