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 class
CommitLogObservers.ForwardingObserver
A @{link LogObserver} that delegates calls to underlying delegate.static class
CommitLogObservers.TerminationStrategy
A strategy to use when maximal error count is reached.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CommitLogObserver
synchronizedObserver(CommitLogObserver delegate)
static CommitLogObserver
withNumRetriedExceptions(java.lang.String name, int numRetries, UnaryFunction<java.lang.Throwable,CommitLogObservers.TerminationStrategy> onRetriesExhausted, CommitLogObserver delegate)
Create aCommitLogObserver
that handles retries onExceptions
thrown during processing.static CommitLogObserver
withNumRetriedExceptions(java.lang.String name, int numRetries, CommitLogObserver delegate)
Create aCommitLogObserver
that handles retries onExceptions
thrown during processing.static CommitLogObserver
withNumRetriedThrowables(java.lang.String name, int numRetries, UnaryFunction<java.lang.Throwable,CommitLogObservers.TerminationStrategy> onRetriesExhausted, CommitLogObserver delegate)
Create aCommitLogObserver
that handles retries onThrowables
thrown during processing.static CommitLogObserver
withSortBuffer(CommitLogObserver upstream, java.time.Duration allowedLateness)
CreateCommitLogObserver
that observes data in event time order.static CommitLogObserver
withSortBuffer(CommitLogObserver upstream, java.time.Duration allowedLateness, BiConsumer<StreamElement,CommitLogObserver.OnNextContext> latecomerConsumer)
CreateCommitLogObserver
that observes data in event time order.static CommitLogObserver
withSortBuffer(CommitLogObserver upstream, java.time.Duration allowedLateness, Consumer<StreamElement> latecomerConsumer)
CreateCommitLogObserver
that observes data in event time order.static CommitLogObserver
withSortBufferWithinPartition(CommitLogObserver upstream, java.time.Duration allowedLateness)
CreateCommitLogObserver
that observes data in event time order per partition.static CommitLogObserver
withSortBufferWithinPartition(CommitLogObserver upstream, java.time.Duration allowedLateness, BiConsumer<StreamElement,CommitLogObserver.OnNextContext> latecomerConsumer)
CreateCommitLogObserver
that observes data in event time order per partition.static CommitLogObserver
withSortBufferWithinPartition(CommitLogObserver upstream, java.time.Duration allowedLateness, Consumer<StreamElement> latecomerConsumer)
CreateCommitLogObserver
that observes data in event time order per partition.
-
-
-
Method Detail
-
withNumRetriedExceptions
public static CommitLogObserver withNumRetriedExceptions(java.lang.String name, int numRetries, CommitLogObserver delegate)
Create aCommitLogObserver
that handles retries onExceptions
thrown 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
- theCommitLogObserver
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 aCommitLogObserver
that handles retries onExceptions
thrown 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 forThrowable
caught during processing and not retrieddelegate
- theCommitLogObserver
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 aCommitLogObserver
that handles retries onThrowables
thrown 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 forThrowable
caught during processing and not retrieddelegate
- theCommitLogObserver
to handle to processing- Returns:
CommitLogObserver
that will retry processing
-
withSortBuffer
public static CommitLogObserver withSortBuffer(CommitLogObserver upstream, java.time.Duration allowedLateness)
CreateCommitLogObserver
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 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)
CreateCommitLogObserver
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 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)
CreateCommitLogObserver
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 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)
CreateCommitLogObserver
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 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)
CreateCommitLogObserver
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 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)
CreateCommitLogObserver
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 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)
-
-