Interface ChangeFeedProcessor
-
public interface ChangeFeedProcessor
Simple host for distributing change feed events across observers and thus allowing these observers scale. It distributes the load across its instances and allows dynamic scaling: - Partitions in partitioned collections are distributed across instances/observers. - New instance takes leases from existing instances to make distribution equal. - If an instance dies, the leases are distributed across remaining instances. It's useful for scenario when partition count is high so that one host/VM is not capable of processing that many change feed events. Client application needs to implementChangeFeedObserver
and register processor implementation withChangeFeedProcessor
.It uses auxiliary document collection for managing leases for a partition. Every EventProcessorHost instance is performing the following two tasks: 1) Renew Leases: It keeps track of leases currently owned by the host and continuously keeps on renewing the leases. 2) Acquire Leases: Each instance continuously polls all leases to check if there are any leases it should acquire for the system to get into balanced state.
ChangeFeedProcessor changeFeedProcessor = ChangeFeedProcessor.Builder() .hostName(hostName) .feedContainer(feedContainer) .leaseContainer(leaseContainer) .handleChanges(docs -> { // Implementation for handling and processing CosmosItemProperties list goes here }) .build();
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ChangeFeedProcessor.BuilderDefinition
TheChangeFeedProcessor
builder definitions for setting the properties.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static ChangeFeedProcessor.BuilderDefinition
Builder()
Helper static method to buildChangeFeedProcessor
instances as logical representation of the Azure Cosmos DB database service.Mono<Void>
start()
Start listening for changes asynchronously.Mono<Void>
stop()
Stops listening for changes asynchronously.
-
-
-
Method Detail
-
start
Mono<Void> start()
Start listening for changes asynchronously.- Returns:
- a representation of the deferred computation of this call.
-
stop
Mono<Void> stop()
Stops listening for changes asynchronously.- Returns:
- a representation of the deferred computation of this call.
-
Builder
static ChangeFeedProcessor.BuilderDefinition Builder()
Helper static method to buildChangeFeedProcessor
instances as logical representation of the Azure Cosmos DB database service.ChangeFeedProcessor.Builder() .hostName("SampleHost") .feedContainer(feedContainer) .leaseContainer(leaseContainer) .handleChanges(docs -> { // Implementation for handling and processing CosmosItemProperties list goes here }) .build();
- Returns:
- a builder definition instance.
-
-