public class ChangeFeedProcessorBuilder extends Object
ChangeFeedProcessor
instance.
ChangeFeedProcessor changeFeedProcessor = new ChangeFeedProcessorBuilder() .hostName(hostName) .feedContainer(feedContainer) .leaseContainer(leaseContainer) .handleChanges(docs -> { for (JsonNode item : docs) { // Implementation for handling and processing of each JsonNode item goes here } }) .buildChangeFeedProcessor();
Constructor and Description |
---|
ChangeFeedProcessorBuilder()
Instantiates a new Cosmos a new ChangeFeedProcessor builder.
|
Modifier and Type | Method and Description |
---|---|
ChangeFeedProcessor |
buildChangeFeedProcessor()
Builds a new instance of the
ChangeFeedProcessor with the specified configuration. |
ChangeFeedProcessorBuilder |
feedContainer(CosmosAsyncContainer feedContainer)
Sets and existing
CosmosAsyncContainer to be used to read from the monitored container. |
ChangeFeedProcessorBuilder |
handleChanges(Consumer<List<JsonNode>> consumer)
Sets a consumer function which will be called to process changes.
|
ChangeFeedProcessorBuilder |
hostName(String hostName)
Sets the host name.
|
ChangeFeedProcessorBuilder |
leaseContainer(CosmosAsyncContainer leaseContainer)
Sets an existing
CosmosAsyncContainer to be used to read from the leases container. |
ChangeFeedProcessorBuilder |
options(ChangeFeedProcessorOptions changeFeedProcessorOptions)
Sets the
ChangeFeedProcessorOptions to be used. |
public ChangeFeedProcessorBuilder()
public ChangeFeedProcessorBuilder hostName(String hostName)
hostName
- the name to be used for the host. When using multiple hosts, each host must have a unique
name.public ChangeFeedProcessorBuilder feedContainer(CosmosAsyncContainer feedContainer)
CosmosAsyncContainer
to be used to read from the monitored container.feedContainer
- the instance of CosmosAsyncContainer
to be used.public ChangeFeedProcessorBuilder leaseContainer(CosmosAsyncContainer leaseContainer)
CosmosAsyncContainer
to be used to read from the leases container.leaseContainer
- the instance of CosmosAsyncContainer
to use.public ChangeFeedProcessorBuilder handleChanges(Consumer<List<JsonNode>> consumer)
.handleChanges(docs -> { for (JsonNode item : docs) { // Implementation for handling and processing of each JsonNode item goes here } })
consumer
- the Consumer
to call for handling the feeds.public ChangeFeedProcessorBuilder options(ChangeFeedProcessorOptions changeFeedProcessorOptions)
ChangeFeedProcessorOptions
to be used.
Unless specifically set the default values that will be used are:
changeFeedProcessorOptions
- the change feed processor options to use.public ChangeFeedProcessor buildChangeFeedProcessor()
ChangeFeedProcessor
with the specified configuration.ChangeFeedProcessor
.Copyright © 2021 Microsoft Corporation. All rights reserved.