Class CommitLogObservers


  • public class CommitLogObservers
    extends java.lang.Object
    • Method Detail

      • withNumRetriedExceptions

        public static CommitLogObserver withNumRetriedExceptions​(java.lang.String name,
                                                                 int numRetries,
                                                                 CommitLogObserver delegate)
        Create a CommitLogObserver that handles retries on Exceptions thrown during processing. If retries are exhausted, the last caught Exception is rethrown.
        Parameters:
        name - name of the consumer
        numRetries - number of retries that should be attempted
        delegate - the CommitLogObserver to handle to processing
        Returns:
        CommitLogObserver that will retry processing
      • withNumRetriedExceptions

        public static CommitLogObserver withNumRetriedExceptions​(java.lang.String name,
                                                                 int numRetries,
                                                                 UnaryFunction<java.lang.Throwable,​CommitLogObservers.TerminationStrategy> onRetriesExhausted,
                                                                 CommitLogObserver delegate)
        Create a CommitLogObserver that handles retries on Exceptions thrown during processing. If retries are exhausted, the last caught Exception is rethrown.
        Parameters:
        name - name of the consumer
        numRetries - number of retries that should be attempted
        onRetriesExhausted - handler for Throwable caught during processing and not retried
        delegate - the CommitLogObserver to handle to processing
        Returns:
        CommitLogObserver that will retry processing
      • withNumRetriedThrowables

        public static CommitLogObserver withNumRetriedThrowables​(java.lang.String name,
                                                                 int numRetries,
                                                                 UnaryFunction<java.lang.Throwable,​CommitLogObservers.TerminationStrategy> onRetriesExhausted,
                                                                 CommitLogObserver delegate)
        Create a CommitLogObserver that handles retries on Throwables thrown during processing. If retries are exhausted, the last caught Throwable is rethrown.
        Parameters:
        name - name of the consumer
        numRetries - number of retries that should be attempted
        onRetriesExhausted - handler for Throwable caught during processing and not retried
        delegate - the CommitLogObserver to handle to processing
        Returns:
        CommitLogObserver that will retry processing
      • withSortBuffer

        public static CommitLogObserver withSortBuffer​(CommitLogObserver upstream,
                                                       java.time.Duration allowedLateness)
        Create CommitLogObserver that observes data in event time order.

        Data are first buffered into temporal buffer and hold until watermark - allowed lateness.

        Parameters:
        upstream - the upstream observer that observes ordered data
        allowedLateness - mixture of event time and processing time lateness
        Returns:
        the observer to use for CommitLogReader.observe(String, CommitLogObserver)
      • withSortBuffer

        public static CommitLogObserver withSortBuffer​(CommitLogObserver upstream,
                                                       java.time.Duration allowedLateness,
                                                       Consumer<StreamElement> latecomerConsumer)
        Create CommitLogObserver that observes data in event time order.

        Data are first buffered into temporal buffer and hold until watermark - allowed lateness.

        Parameters:
        upstream - the upstream observer that observes ordered data
        allowedLateness - mixture of event time and processing time lateness
        latecomerConsumer - consumer of data that had to be dropped due to allowed lateness *
        Returns:
        the observer to use for CommitLogReader.observe(String, CommitLogObserver)
      • withSortBufferWithinPartition

        public static CommitLogObserver withSortBufferWithinPartition​(CommitLogObserver upstream,
                                                                      java.time.Duration allowedLateness)
        Create CommitLogObserver that observes data in event time order per partition.

        Data are first buffered into temporal buffer and hold until watermark - allowed lateness.

        Parameters:
        upstream - the upstream observer that observes ordered data
        allowedLateness - mixture of event time and processing time lateness
        Returns:
        the observer to use for CommitLogReader.observe(String, CommitLogObserver)
      • withSortBufferWithinPartition

        public static CommitLogObserver withSortBufferWithinPartition​(CommitLogObserver upstream,
                                                                      java.time.Duration allowedLateness,
                                                                      Consumer<StreamElement> latecomerConsumer)
        Create CommitLogObserver that observes data in event time order per partition.

        Data are first buffered into temporal buffer and hold until watermark - allowed lateness.

        Parameters:
        upstream - the upstream observer that observes ordered data
        allowedLateness - mixture of event time and processing time lateness
        latecomerConsumer - consumer of data that had to be dropped due to allowed lateness *
        Returns:
        the observer to use for CommitLogReader.observe(String, CommitLogObserver)