Class CommitLogObservers
- java.lang.Object
-
- cz.o2.proxima.direct.core.commitlog.CommitLogObservers
-
public class CommitLogObservers extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCommitLogObservers.ForwardingObserverA @{link LogObserver} that delegates calls to underlying delegate.static classCommitLogObservers.TerminationStrategyA strategy to use when maximal error count is reached.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CommitLogObserversynchronizedObserver(CommitLogObserver delegate)static CommitLogObserverwithNumRetriedExceptions(java.lang.String name, int numRetries, UnaryFunction<java.lang.Throwable,CommitLogObservers.TerminationStrategy> onRetriesExhausted, CommitLogObserver delegate)Create aCommitLogObserverthat handles retries onExceptionsthrown during processing.static CommitLogObserverwithNumRetriedExceptions(java.lang.String name, int numRetries, CommitLogObserver delegate)Create aCommitLogObserverthat handles retries onExceptionsthrown during processing.static CommitLogObserverwithNumRetriedThrowables(java.lang.String name, int numRetries, UnaryFunction<java.lang.Throwable,CommitLogObservers.TerminationStrategy> onRetriesExhausted, CommitLogObserver delegate)Create aCommitLogObserverthat handles retries onThrowablesthrown during processing.static CommitLogObserverwithSortBuffer(CommitLogObserver upstream, java.time.Duration allowedLateness)CreateCommitLogObserverthat observes data in event time order.static CommitLogObserverwithSortBuffer(CommitLogObserver upstream, java.time.Duration allowedLateness, BiConsumer<StreamElement,CommitLogObserver.OnNextContext> latecomerConsumer)CreateCommitLogObserverthat observes data in event time order.static CommitLogObserverwithSortBuffer(CommitLogObserver upstream, java.time.Duration allowedLateness, Consumer<StreamElement> latecomerConsumer)CreateCommitLogObserverthat observes data in event time order.static CommitLogObserverwithSortBufferWithinPartition(CommitLogObserver upstream, java.time.Duration allowedLateness)CreateCommitLogObserverthat observes data in event time order per partition.static CommitLogObserverwithSortBufferWithinPartition(CommitLogObserver upstream, java.time.Duration allowedLateness, BiConsumer<StreamElement,CommitLogObserver.OnNextContext> latecomerConsumer)CreateCommitLogObserverthat observes data in event time order per partition.static CommitLogObserverwithSortBufferWithinPartition(CommitLogObserver upstream, java.time.Duration allowedLateness, Consumer<StreamElement> latecomerConsumer)CreateCommitLogObserverthat observes data in event time order per partition.
-
-
-
Method Detail
-
withNumRetriedExceptions
public static CommitLogObserver withNumRetriedExceptions(java.lang.String name, int numRetries, CommitLogObserver delegate)
Create aCommitLogObserverthat handles retries onExceptionsthrown during processing. If retries are exhausted, the last caught Exception is rethrown.- Parameters:
name- name of the consumernumRetries- number of retries that should be attempteddelegate- theCommitLogObserverto handle to processing- Returns:
CommitLogObserverthat will retry processing
-
withNumRetriedExceptions
public static CommitLogObserver withNumRetriedExceptions(java.lang.String name, int numRetries, UnaryFunction<java.lang.Throwable,CommitLogObservers.TerminationStrategy> onRetriesExhausted, CommitLogObserver delegate)
Create aCommitLogObserverthat handles retries onExceptionsthrown during processing. If retries are exhausted, the last caught Exception is rethrown.- Parameters:
name- name of the consumernumRetries- number of retries that should be attemptedonRetriesExhausted- handler forThrowablecaught during processing and not retrieddelegate- theCommitLogObserverto handle to processing- Returns:
CommitLogObserverthat will retry processing
-
withNumRetriedThrowables
public static CommitLogObserver withNumRetriedThrowables(java.lang.String name, int numRetries, UnaryFunction<java.lang.Throwable,CommitLogObservers.TerminationStrategy> onRetriesExhausted, CommitLogObserver delegate)
Create aCommitLogObserverthat handles retries onThrowablesthrown during processing. If retries are exhausted, the last caught Throwable is rethrown.- Parameters:
name- name of the consumernumRetries- number of retries that should be attemptedonRetriesExhausted- handler forThrowablecaught during processing and not retrieddelegate- theCommitLogObserverto handle to processing- Returns:
CommitLogObserverthat will retry processing
-
withSortBuffer
public static CommitLogObserver withSortBuffer(CommitLogObserver upstream, java.time.Duration allowedLateness)
CreateCommitLogObserverthat 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 dataallowedLateness- 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)
CreateCommitLogObserverthat 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 dataallowedLateness- mixture of event time and processing time latenesslatecomerConsumer- consumer of data that had to be dropped due to allowed lateness *- Returns:
- the observer to use for
CommitLogReader.observe(String, CommitLogObserver)
-
withSortBuffer
public static CommitLogObserver withSortBuffer(CommitLogObserver upstream, java.time.Duration allowedLateness, BiConsumer<StreamElement,CommitLogObserver.OnNextContext> latecomerConsumer)
CreateCommitLogObserverthat 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 dataallowedLateness- mixture of event time and processing time latenesslatecomerConsumer- 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)
CreateCommitLogObserverthat 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 dataallowedLateness- 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)
CreateCommitLogObserverthat 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 dataallowedLateness- mixture of event time and processing time latenesslatecomerConsumer- 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, BiConsumer<StreamElement,CommitLogObserver.OnNextContext> latecomerConsumer)
CreateCommitLogObserverthat 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 dataallowedLateness- mixture of event time and processing time latenesslatecomerConsumer- consumer of data that had to be dropped due to allowed lateness *- Returns:
- the observer to use for
CommitLogReader.observe(String, CommitLogObserver)
-
synchronizedObserver
public static CommitLogObserver synchronizedObserver(CommitLogObserver delegate)
-
-