Package cz.o2.proxima.direct.core.batch
Class BatchLogReaders.ForwardingBatchLogObserver
- java.lang.Object
-
- cz.o2.proxima.direct.core.batch.BatchLogReaders.ForwardingBatchLogObserver
-
- All Implemented Interfaces:
BatchLogObserver,LogObserver<Offset,BatchLogObserver.OnNextContext>
- Enclosing class:
- BatchLogReaders
public static class BatchLogReaders.ForwardingBatchLogObserver extends java.lang.Object implements BatchLogObserver
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface cz.o2.proxima.direct.core.batch.BatchLogObserver
BatchLogObserver.OnNextContext
-
-
Constructor Summary
Constructors Constructor Description ForwardingBatchLogObserver(BatchLogObserver delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonCancelled()Notify that the processing has been canceled.voidonCompleted()Notify that the processing has gracefully ended.booleanonError(java.lang.Throwable error)Called to notify there was anerrorin the commit reader.booleanonException(java.lang.Exception exception)Called to notify there was anexceptionin the commit reader.booleanonFatalError(java.lang.Error error)Called to notify there was anerrorin the commit reader.voidonInterrupted()Called when the consumption is cancelled in caseBatchLogObserver.onNext(StreamElement, OnNextContext)method is blocked and should be interrupted.booleanonNext(StreamElement element)Read next data from the batch storage.booleanonNext(StreamElement element, BatchLogObserver.OnNextContext context)Process next record in the commit log.
-
-
-
Constructor Detail
-
ForwardingBatchLogObserver
public ForwardingBatchLogObserver(BatchLogObserver delegate)
-
-
Method Detail
-
onNext
public boolean onNext(StreamElement element)
Description copied from interface:BatchLogObserverRead next data from the batch storage.- Specified by:
onNextin interfaceBatchLogObserver- Parameters:
element- the retrieved data element- Returns:
trueto continue processing,falseotherwise
-
onNext
public boolean onNext(StreamElement element, BatchLogObserver.OnNextContext context)
Description copied from interface:LogObserverProcess next record in the commit log.- Specified by:
onNextin interfaceBatchLogObserver- Specified by:
onNextin interfaceLogObserver<Offset,BatchLogObserver.OnNextContext>- Parameters:
element- the element written to the commit logcontext- a context that the application must use to confirm processing of the element. If the application fails to do so, the result is undefined.- Returns:
trueif the processing should continue,falseotherwise
-
onInterrupted
public void onInterrupted()
Description copied from interface:BatchLogObserverCalled when the consumption is cancelled in caseBatchLogObserver.onNext(StreamElement, OnNextContext)method is blocked and should be interrupted.- Specified by:
onInterruptedin interfaceBatchLogObserver
-
onCompleted
public void onCompleted()
Description copied from interface:LogObserverNotify that the processing has gracefully ended.- Specified by:
onCompletedin interfaceLogObserver<Offset,BatchLogObserver.OnNextContext>
-
onCancelled
public void onCancelled()
Description copied from interface:LogObserverNotify that the processing has been canceled.- Specified by:
onCancelledin interfaceLogObserver<Offset,BatchLogObserver.OnNextContext>
-
onError
public boolean onError(java.lang.Throwable error)
Description copied from interface:LogObserverCalled to notify there was anerrorin the commit reader.- Specified by:
onErrorin interfaceLogObserver<Offset,BatchLogObserver.OnNextContext>- Parameters:
error- error caught during processing- Returns:
trueto restart processing from last committed position,falseto stop processing
-
onException
public boolean onException(java.lang.Exception exception)
Description copied from interface:LogObserverCalled to notify there was anexceptionin the commit reader. There is no guarantee this method gets called, ifLogObserver.onError(Throwable)is overridden.- Specified by:
onExceptionin interfaceLogObserver<Offset,BatchLogObserver.OnNextContext>- Parameters:
exception- exception caught during processing- Returns:
trueto restart processing from last committed position,falseto stop processing
-
onFatalError
public boolean onFatalError(java.lang.Error error)
Description copied from interface:LogObserverCalled to notify there was anerrorin the commit reader. There is no guarantee this method gets called, ifLogObserver.onError(Throwable)is overridden.- Specified by:
onFatalErrorin interfaceLogObserver<Offset,BatchLogObserver.OnNextContext>- Parameters:
error- error caught during processing- Returns:
trueto restart processing from last committed position,falseto stop processing
-
-