private abstract static class LogObservers.AbstractSortedLogObserver extends java.lang.Object implements LogObserver
LogObserver.OffsetCommitter, LogObserver.OnIdleContext, LogObserver.OnNextContext, LogObserver.OnRepartitionContext| Modifier and Type | Field and Description |
|---|---|
(package private) long |
allowedLatenessMs |
(package private) BiConsumer<StreamElement,LogObserver.OnNextContext> |
latecomerConsumer |
(package private) LogObserver |
upstream |
| Constructor and Description |
|---|
AbstractSortedLogObserver(LogObserver upstream,
java.time.Duration allowedLateness,
BiConsumer<StreamElement,LogObserver.OnNextContext> latecomerConsumer) |
| Modifier and Type | Method and Description |
|---|---|
(package private) boolean |
drainQueue(java.util.PriorityQueue<Pair<StreamElement,LogObserver.OnNextContext>> queue,
long maxTimestamp) |
(package private) abstract void |
enqueue(StreamElement ingest,
LogObserver.OnNextContext context) |
(package private) abstract long |
getWatermark(LogObserver.OnNextContext context) |
void |
onCancelled()
Notify that the processing has been canceled.
|
void |
onCompleted()
Notify that the processing has gracefully ended.
|
(package private) abstract void |
onCompletedDrainQueue() |
boolean |
onError(java.lang.Throwable error)
Called to notify there was an {@link Throwable error) in the commit reader.
|
void |
onIdle(LogObserver.OnIdleContext context)
Called when the observer is idle.
|
(package private) abstract void |
onIdleDrainQueue(LogObserver.OnIdleContext context) |
boolean |
onNext(StreamElement ingest,
LogObserver.OnNextContext context)
Process next record in the commit log.
|
(package private) abstract boolean |
onNextDrainQueue(LogObserver.OnNextContext context) |
void |
onRepartition(LogObserver.OnRepartitionContext context)
Callback to notify of automatic repartitioning.
|
protected abstract void |
reassignPartitions(java.util.Collection<Partition> partitions) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonException, onFatalErrorfinal LogObserver upstream
final long allowedLatenessMs
final BiConsumer<StreamElement,LogObserver.OnNextContext> latecomerConsumer
public AbstractSortedLogObserver(LogObserver upstream, java.time.Duration allowedLateness, BiConsumer<StreamElement,LogObserver.OnNextContext> latecomerConsumer)
public void onCompleted()
LogObserveronCompleted in interface LogObserverpublic void onCancelled()
LogObserveronCancelled in interface LogObserverpublic boolean onError(java.lang.Throwable error)
LogObserveronError in interface LogObservererror - error caught during processingtrue to restart processing from last committed position, false to stop
processingpublic boolean onNext(StreamElement ingest, LogObserver.OnNextContext context)
LogObserveronNext in interface LogObserveringest - the ingested data written to the commit logcontext - a context that the application must use to confirm processing of the ingest. If
the application fails to do so, the result is undefined.true if the processing should continue, false otherwisepublic void onRepartition(LogObserver.OnRepartitionContext context)
LogObserverLogObserver.onNext(cz.o2.proxima.storage.StreamElement, cz.o2.proxima.direct.commitlog.LogObserver.OnNextContext) call happens.onRepartition in interface LogObservercontext - context of the repartitionpublic void onIdle(LogObserver.OnIdleContext context)
LogObserverLogObserver.onNext(cz.o2.proxima.storage.StreamElement, cz.o2.proxima.direct.commitlog.LogObserver.OnNextContext) will be called eventually.
Typical example of commit log with no need to call LogObserver.onIdle(cz.o2.proxima.direct.commitlog.LogObserver.OnIdleContext) is google PubSub, having
virtually single shared partition which loads balances incoming data.
onIdle in interface LogObservercontext - the context for on idle processingabstract void enqueue(StreamElement ingest, LogObserver.OnNextContext context)
abstract void onCompletedDrainQueue()
abstract boolean onNextDrainQueue(LogObserver.OnNextContext context)
abstract void onIdleDrainQueue(LogObserver.OnIdleContext context)
protected abstract void reassignPartitions(java.util.Collection<Partition> partitions)
abstract long getWatermark(LogObserver.OnNextContext context)
boolean drainQueue(java.util.PriorityQueue<Pair<StreamElement,LogObserver.OnNextContext>> queue, long maxTimestamp)
Copyright © 2017–2021. All rights reserved.