public interface BatchListener<T extends BatchEvent>
processEvent
Modifier and Type | Method and Description |
---|---|
void |
processEvent(T batch)
The method called by QueryBatcher or
WriteBatcher to run your custom code on this batch.
|
void processEvent(T batch)
The method called by QueryBatcher or WriteBatcher to run your custom code on this batch. You usually implement this as a lambda expression.
For example, see the lambda expression passed to onUrisReady:
QueryBatcher qhb = dataMovementManager.newQueryBatcher(query)
.withBatchSize(1000)
.withThreadCount(20)
.onUrisReady(batch -> {
for ( String uri : batch.getItems() ) {
if ( uri.endsWith(".txt") ) {
batch.getClient().newDocumentManager().delete(uri);
}
}
})
.onQueryFailure(queryBatchException -> queryBatchException.printStackTrace());
JobTicket ticket = dataMovementManager.startJob(qhb);
qhb.awaitCompletion();
dataMovementManager.stopJob(ticket);
batch
- the batch of uris and some metadata about
the current status of the jobCopyright © 2024 MarkLogic Corporation. All Rights Reserved.