desc: "Simple host for distributing change feed events across observers, simplifying the process of reading the change feeds and distributing the processing events across multiple consumers effectively.\n\nThere are four main components of implementing the change feed processor:\n\n * The monitored container: the monitored container has the data from which the change feed is generated. Any inserts and updates to the monitored container are reflected in the change feed of the container.\n * The lease container: the lease container acts as a state storage and coordinates processing the change feed across multiple workers. The lease container can be stored in the same account as the monitored container or in a separate account.\n * The host: a host is an application instance that uses the change feed processor to listen for changes. Multiple instances with the same lease configuration can run in parallel, but each instance should have a different instance name.\n * The delegate: the delegate is the code that defines what you, the developer, want to do with each batch of changes that the change feed processor reads.\n\nBelow is an example of building ChangeFeedProcessor for LatestVersion mode.\n\n```java\nChangeFeedProcessor changeFeedProcessor = new ChangeFeedProcessorBuilder()\n .hostName(hostName)\n .feedContainer(feedContainer)\n .leaseContainer(leaseContainer)\n .handleChanges(docs -> {\n for (JsonNode item : docs) {\n // Implementation for handling and processing of each JsonNode item goes here\n }\n })\n .buildChangeFeedProcessor();\n```\n\nBelow is an example of building ChangeFeedProcessor for AllVersionsAndDeletes mode.\n\n```java\nChangeFeedProcessor changeFeedProcessor = new ChangeFeedProcessorBuilder()\n .hostName(hostName)\n .feedContainer(feedContainer)\n .leaseContainer(leaseContainer)\n .handleAllVersionsAndDeletesChanges(docs -> {\n for (ChangeFeedProcessorItem item : docs) {\n // Implementation for handling and processing of each ChangeFeedProcessorItem item goes here\n }\n })\n .buildChangeFeedProcessor();\n```"
0 commit comments