public interface BatchConsumer extends java.util.function.BiConsumer<BatchIterator,java.lang.Throwable>
BatchIterator
.
The consumer will start consuming the rows from the BatchIterator
once
accept(BatchIterator, Throwable)
is called.
Once the consumer has consumed all data, or as much as it needs, it calls BatchIterator.close()
.
An exception to this is if the throwable in the accept(BatchIterator, Throwable)
call isn't null.
In that case the Consumer is not required to call close, as the iterator may even be null.
Multiple calls to accept(BatchIterator, Throwable)
are not allowed.
Modifier and Type | Method and Description |
---|---|
void |
accept(BatchIterator iterator,
java.lang.Throwable failure)
Start consumption of the given
BatchIterator . |
default boolean |
requiresScroll() |
void accept(BatchIterator iterator, @Nullable java.lang.Throwable failure)
BatchIterator
.
The given iterator must be in it's start position and must be usable until BatchIterator.close()
is called.
If failure
is not null the iterator
cannot be used,
but instead the consumer has to process the failure.
accept
in interface java.util.function.BiConsumer<BatchIterator,java.lang.Throwable>
iterator
- the iterator to be consumed, if a failure is present this iterator isn't usable or null.failure
- the cause of the failure or null if successfuldefault boolean requiresScroll()
BatchIterator.moveToStart()