Class ChangeFeedEncryptionProcessorBuilder

java.lang.Object
com.azure.cosmos.encryption.ChangeFeedEncryptionProcessorBuilder

public final class ChangeFeedEncryptionProcessorBuilder extends Object
Helper class to build a ChangeFeedProcessor instance for encryption feed container.
 ChangeFeedProcessor changeFeedProcessor = new ChangeFeedProcessorBuilder()
     .hostName(hostName)
     .feedContainer(feedContainer) // CosmosEncryptionAsyncContainer
     .leaseContainer(leaseContainer)
     .handleChanges(docs -> {
         for (JsonNode item : docs) {
             // Implementation for handling and processing of each JsonNode item goes here
         }
     })
     .buildChangeFeedProcessor();
 
  • Constructor Details

    • ChangeFeedEncryptionProcessorBuilder

      public ChangeFeedEncryptionProcessorBuilder()
      Helper class to build a encryption supported ChangeFeedProcessor instance.
  • Method Details

    • hostName

      public ChangeFeedEncryptionProcessorBuilder hostName(String hostName)
      Sets the host name.
      Parameters:
      hostName - the name to be used for the host. When using multiple hosts, each host must have a unique name.
      Returns:
      current Builder.
    • feedContainer

      Sets an existing CosmosEncryptionAsyncContainer to be used to read from the monitored container.
      Parameters:
      feedContainer - the instance of CosmosEncryptionAsyncContainer to be used.
      Returns:
      current Builder.
    • leaseContainer

      public ChangeFeedEncryptionProcessorBuilder leaseContainer(com.azure.cosmos.CosmosAsyncContainer leaseContainer)
      Sets an existing CosmosAsyncContainer to be used to read from the leases container.
      Parameters:
      leaseContainer - the instance of CosmosAsyncContainer to use.
      Returns:
      current Builder.
    • handleChanges

      public ChangeFeedEncryptionProcessorBuilder handleChanges(Consumer<List<JsonNode>> consumer)
      Sets a consumer function which will be called to process changes.
      Parameters:
      consumer - the Consumer to call for handling the feeds.
      Returns:
      current Builder.
    • options

      public ChangeFeedEncryptionProcessorBuilder options(com.azure.cosmos.models.ChangeFeedProcessorOptions changeFeedProcessorOptions)
      Sets the ChangeFeedProcessorOptions to be used. Unless specifically set the default values that will be used are:
      • maximum items per page or FeedResponse: 100
      • lease renew interval: 17 seconds
      • lease acquire interval: 13 seconds
      • lease expiration interval: 60 seconds
      • feed poll delay: 5 seconds
      • maximum scale count: unlimited
      Parameters:
      changeFeedProcessorOptions - the change feed processor options to use.
      Returns:
      current Builder.
    • buildChangeFeedProcessor

      public com.azure.cosmos.ChangeFeedProcessor buildChangeFeedProcessor()
      Builds a new instance of the ChangeFeedProcessor with the specified configuration.
      Returns:
      an instance of ChangeFeedProcessor.