public interface QueryBatcherListener
processEvent
Modifier and Type | Method and Description |
---|---|
void |
processEvent(QueryBatcher batcher)
The method called by QueryBatcher to run your
custom code at the QueryBatcher level.
|
void processEvent(QueryBatcher batcher)
The method called by QueryBatcher to run your custom code at the QueryBatcher level. You usually implement this as a lambda expression.
For example, see the lambda expression passed to onJobCompletion:
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())
.onJobCompletion(batcher -> {
JobReport report = new JobReportImpl(batcher);
System.out.println("Success Batch count " + report.getSuccessBatchesCount());
});
JobTicket ticket = dataMovementManager.startJob(qhb);
qhb.awaitCompletion();
dataMovementManager.stopJob(ticket);
batcher
- the QueryBatcher associated with the
listenerCopyright © 2024 MarkLogic Corporation. All Rights Reserved.