Class ChangeFeedProcessorBuilder
Provides a flexible way to create an instance of ChangeFeedProcessor with custom set of parameters.
public class ChangeFeedProcessorBuilder
- Inheritance
-
ChangeFeedProcessorBuilder
- Inherited Members
- Extension Methods
Methods
Build()
Builds a new instance of the ChangeFeedProcessor with the specified configuration.
public ChangeFeedProcessor Build()
Returns
- ChangeFeedProcessor
An instance of ChangeFeedProcessor.
WithErrorNotification(ChangeFeedMonitorErrorDelegate)
Defines a delegate to receive notifications on errors that occur during change feed processor execution.
public ChangeFeedProcessorBuilder WithErrorNotification(Container.ChangeFeedMonitorErrorDelegate errorDelegate)
Parameters
errorDelegate
Container.ChangeFeedMonitorErrorDelegateA delegate to receive notifications for change feed processor related errors.
Returns
- ChangeFeedProcessorBuilder
The instance of ChangeFeedProcessorBuilder to use.
WithInstanceName(string)
Sets the compute instance name that will host the processor.
public ChangeFeedProcessorBuilder WithInstanceName(string instanceName)
Parameters
instanceName
stringName of compute instance hosting the processor.
Returns
- ChangeFeedProcessorBuilder
The instance of ChangeFeedProcessorBuilder to use.
Remarks
Instance name refers to the unique identifier of the compute that is running the processor. Examples could be a VM instance identifier, a machine name, a pod id. When distributing a processor across a cluster of compute hosts, each compute host should use a different instance name.
WithLeaseAcquireNotification(ChangeFeedMonitorLeaseAcquireDelegate)
Defines a delegate to receive notifications on lease acquires that occur during change feed processor execution.
public ChangeFeedProcessorBuilder WithLeaseAcquireNotification(Container.ChangeFeedMonitorLeaseAcquireDelegate acquireDelegate)
Parameters
acquireDelegate
Container.ChangeFeedMonitorLeaseAcquireDelegateA delegate to receive notifications when a change feed processor acquires a lease.
Returns
- ChangeFeedProcessorBuilder
The instance of ChangeFeedProcessorBuilder to use.
WithLeaseConfiguration(TimeSpan?, TimeSpan?, TimeSpan?)
Sets a custom configuration to be used by this instance of ChangeFeedProcessor to control how leases are maintained in a container when using WithLeaseContainer(Container).
public ChangeFeedProcessorBuilder WithLeaseConfiguration(TimeSpan? acquireInterval = null, TimeSpan? expirationInterval = null, TimeSpan? renewInterval = null)
Parameters
acquireInterval
TimeSpan?Interval to kick off a task to verify if leases are distributed evenly among known host instances.
expirationInterval
TimeSpan?Interval for which the lease is taken. If the lease is not renewed within this interval, it will cause it to expire and ownership of the lease will move to another processor instance.
renewInterval
TimeSpan?Renew interval for all leases currently held by a particular processor instance.
Returns
- ChangeFeedProcessorBuilder
The instance of ChangeFeedProcessorBuilder to use.
WithLeaseContainer(Container)
Sets the Cosmos Container to hold the leases state
public ChangeFeedProcessorBuilder WithLeaseContainer(Container leaseContainer)
Parameters
leaseContainer
ContainerInstance of a Cosmos Container to hold the leases.
Returns
- ChangeFeedProcessorBuilder
The instance of ChangeFeedProcessorBuilder to use.
WithLeaseReleaseNotification(ChangeFeedMonitorLeaseReleaseDelegate)
Defines a delegate to receive notifications on lease releases that occur during change feed processor execution.
public ChangeFeedProcessorBuilder WithLeaseReleaseNotification(Container.ChangeFeedMonitorLeaseReleaseDelegate releaseDelegate)
Parameters
releaseDelegate
Container.ChangeFeedMonitorLeaseReleaseDelegateA delegate to receive notifications when a change feed processor releases a lease.
Returns
- ChangeFeedProcessorBuilder
The instance of ChangeFeedProcessorBuilder to use.
WithMaxItems(int)
Sets the maximum number of items to be returned in the enumeration operation in the Azure Cosmos DB service.
public ChangeFeedProcessorBuilder WithMaxItems(int maxItemCount)
Parameters
maxItemCount
intMaximum amount of items to be returned in a Change Feed request.
Returns
- ChangeFeedProcessorBuilder
An instance of ChangeFeedProcessorBuilder.
Remarks
This is just a hint to the server which can return less or more items per page. If operations in the container are performed through stored procedures or transactional batch, transaction scope is preserved when reading items from the Change Feed. As a result, the number of items received could be higher than the specified value so that the items changed by the same transaction are returned as part of one atomic batch.
WithPollInterval(TimeSpan)
Gets or sets the delay in between polling the change feed for new changes, after all current changes are drained.
public ChangeFeedProcessorBuilder WithPollInterval(TimeSpan pollInterval)
Parameters
pollInterval
TimeSpanPolling interval value.
Returns
- ChangeFeedProcessorBuilder
The instance of ChangeFeedProcessorBuilder to use.
Remarks
Applies only after a read on the change feed yielded no results.
WithStartTime(DateTime)
Sets the time (exclusive) to start looking for changes after.
public ChangeFeedProcessorBuilder WithStartTime(DateTime startTime)
Parameters
startTime
DateTimeDate and time when to start looking for changes.
Returns
- ChangeFeedProcessorBuilder
The instance of ChangeFeedProcessorBuilder to use.
Remarks
This is only used when: (1) Lease store is not initialized and is ignored if a lease exists and has continuation token. (2) StartContinuation is not specified. If this is specified, StartFromBeginning is ignored.