Class ChangeFeedProcessorOptions

    • Constructor Detail

      • ChangeFeedProcessorOptions

        public ChangeFeedProcessorOptions()
    • Method Detail

      • leaseRenewInterval

        public Duration leaseRenewInterval()
        Gets the renew interval for all leases for partitions currently held by ChangeFeedProcessor instance.
        Returns:
        the renew interval for all leases for partitions.
      • leaseRenewInterval

        public ChangeFeedProcessorOptions leaseRenewInterval​(Duration leaseRenewInterval)
        Sets the renew interval for all leases for partitions currently held by ChangeFeedProcessor instance.
        Parameters:
        leaseRenewInterval - the renew interval for all leases for partitions currently held by ChangeFeedProcessor instance.
        Returns:
        the current ChangeFeedProcessorOptions instance.
      • leaseAcquireInterval

        public Duration leaseAcquireInterval()
        Gets the interval to kick off a task to compute if partitions are distributed evenly among known host instances.
        Returns:
        the interval to kick off a task to compute if partitions are distributed evenly among known host instances.
      • leaseAcquireInterval

        public ChangeFeedProcessorOptions leaseAcquireInterval​(Duration leaseAcquireInterval)
        Sets he interval to kick off a task to compute if partitions are distributed evenly among known host instances.
        Parameters:
        leaseAcquireInterval - he interval to kick off a task to compute if partitions are distributed evenly among known host instances.
        Returns:
        the current ChangeFeedProcessorOptions instance.
      • leaseExpirationInterval

        public Duration leaseExpirationInterval()
        Gets the interval for which the lease is taken on a lease representing a partition.

        If the lease is not renewed within this interval, it will cause it to expire and ownership of the partition will move to another ChangeFeedProcessor instance.

        Returns:
        the interval for which the lease is taken on a lease representing a partition.
      • leaseExpirationInterval

        public ChangeFeedProcessorOptions leaseExpirationInterval​(Duration leaseExpirationInterval)
        Sets the interval for which the lease is taken on a lease representing a partition.

        If the lease is not renewed within this interval, it will cause it to expire and ownership of the partition will move to another ChangeFeedProcessor instance.

        Parameters:
        leaseExpirationInterval - the interval for which the lease is taken on a lease representing a partition.
        Returns:
        the current ChangeFeedProcessorOptions instance.
      • feedPollDelay

        public Duration feedPollDelay()
        Gets the delay in between polling a partition for new changes on the feed, after all current changes are drained.
        Returns:
        the delay in between polling a partition for new changes on the feed.
      • feedPollDelay

        public ChangeFeedProcessorOptions feedPollDelay​(Duration feedPollDelay)
        Sets the delay in between polling a partition for new changes on the feed, after all current changes are drained.
        Parameters:
        feedPollDelay - the delay in between polling a partition for new changes on the feed, after all current changes are drained.
        Returns:
        the current ChangeFeedProcessorOptions instance.
      • leasePrefix

        public String leasePrefix()
        Gets a prefix to be used as part of the lease ID.

        This can be used to support multiple instances of ChangeFeedProcessor instances pointing at the same feed while using the same auxiliary collection.

        Returns:
        a prefix to be used as part of the lease ID.
      • leasePrefix

        public ChangeFeedProcessorOptions leasePrefix​(String leasePrefix)
        Sets a prefix to be used as part of the lease ID.
        Parameters:
        leasePrefix - a prefix to be used as part of the lease ID.
        Returns:
        the current ChangeFeedProcessorOptions instance.
      • maxItemCount

        public int maxItemCount()
        Gets the maximum number of items to be returned in the enumeration operation in the Azure Cosmos DB service.
        Returns:
        the maximum number of items to be returned in the enumeration operation in the Azure Cosmos DB service.
      • maxItemCount

        public ChangeFeedProcessorOptions maxItemCount​(int maxItemCount)
        Sets the maximum number of items to be returned in the enumeration operation.
        Parameters:
        maxItemCount - the maximum number of items to be returned in the enumeration operation.
        Returns:
        the current ChangeFeedProcessorOptions instance.
      • startContinuation

        public String startContinuation()
        Gets the start request continuation token to start looking for changes after.

        This is only used when lease store is not initialized and is ignored if a lease for partition exists and has continuation token. If this is specified, both StartTime and StartFromBeginning are ignored.

        Returns:
        the start request continuation token to start looking for changes after.
      • startContinuation

        public ChangeFeedProcessorOptions startContinuation​(String startContinuation)
        Sets the start request continuation token to start looking for changes after.

        This is only used when lease store is not initialized and is ignored if a lease for partition exists and has continuation token. If this is specified, both StartTime and StartFromBeginning are ignored.

        Parameters:
        startContinuation - the start request continuation token to start looking for changes after.
        Returns:
        the current ChangeFeedProcessorOptions instance.
      • startTime

        public OffsetDateTime startTime()
        Gets the time (exclusive) to start looking for changes after.

        This is only used when: (1) Lease store is not initialized and is ignored if a lease for partition exists and has continuation token. (2) StartContinuation is not specified. If this is specified, StartFromBeginning is ignored.

        Returns:
        the time (exclusive) to start looking for changes after.
      • startTime

        public ChangeFeedProcessorOptions startTime​(OffsetDateTime startTime)
        Sets the time (exclusive) to start looking for changes after (UTC time).

        This is only used when: (1) Lease store is not initialized and is ignored if a lease for partition exists and has continuation token. (2) StartContinuation is not specified. If this is specified, StartFromBeginning is ignored.

        Parameters:
        startTime - the time (exclusive) to start looking for changes after.
        Returns:
        the current ChangeFeedProcessorOptions instance.
      • startFromBeginning

        public boolean startFromBeginning()
        Gets a value indicating whether change feed in the Azure Cosmos DB service should start from beginning (true) or from current (false). By default it's start from current (false).

        This is only used when: (1) Lease store is not initialized and is ignored if a lease for partition exists and has continuation token. (2) StartContinuation is not specified. (3) StartTime is not specified.

        Returns:
        a value indicating whether change feed in the Azure Cosmos DB service should start from.
      • startFromBeginning

        public ChangeFeedProcessorOptions startFromBeginning​(boolean startFromBeginning)
        Sets a value indicating whether change feed in the Azure Cosmos DB service should start from beginning.

        This is only used when: (1) Lease store is not initialized and is ignored if a lease for partition exists and has continuation token. (2) StartContinuation is not specified. (3) StartTime is not specified.

        Parameters:
        startFromBeginning - Indicates to start from beginning if true
        Returns:
        the current ChangeFeedProcessorOptions instance.
      • minScaleCount

        public int minScaleCount()
        Gets the minimum partition count for the host.

        This can be used to increase the number of partitions for the host and thus override equal distribution (which is the default) of leases between hosts.

        Returns:
        the minimum scale count for the host.
      • minScaleCount

        public ChangeFeedProcessorOptions minScaleCount​(int minScaleCount)
        Sets the minimum partition count for the host.

        This can be used to increase the number of partitions for the host and thus override equal distribution (which is the default) of leases between hosts.

        Parameters:
        minScaleCount - the minimum partition count for the host.
        Returns:
        the current ChangeFeedProcessorOptions instance.
      • maxScaleCount

        public int maxScaleCount()
        Gets the maximum number of partitions the host can serve.

        This can be used property to limit the number of partitions for the host and thus override equal distribution (which is the default) of leases between hosts. DEFAULT is 0 (unlimited).

        Returns:
        the maximum number of partitions the host can serve.
      • maxScaleCount

        public ChangeFeedProcessorOptions maxScaleCount​(int maxScaleCount)
        Sets the maximum number of partitions the host can serve.
        Parameters:
        maxScaleCount - the maximum number of partitions the host can serve.
        Returns:
        the current ChangeFeedProcessorOptions instance.
      • discardExistingLeases

        public boolean discardExistingLeases()
        Gets a value indicating whether on start of the host all existing leases should be deleted and the host should start from scratch.
        Returns:
        a value indicating whether on start of the host all existing leases should be deleted and the host should start from scratch.
      • discardExistingLeases

        public ChangeFeedProcessorOptions discardExistingLeases​(boolean discardExistingLeases)
        Sets a value indicating whether on start of the host all existing leases should be deleted and the host should start from scratch.
        Parameters:
        discardExistingLeases - Indicates whether to discard all existing leases if true
        Returns:
        the current ChangeFeedProcessorOptions instance.