BatchListener<QueryBatch>
,
QueryBatchListener
public class JobInformationRecorder.addQueryBatchSuccessInformationListener extends java.lang.Object implements QueryBatchListener
Constructor | Description |
---|---|
addQueryBatchSuccessInformationListener() |
Modifier and Type | Method | Description |
---|---|---|
void |
processEvent(QueryBatch batch) |
The method called by QueryBatcher or
WriteBatcher to run your custom code on this batch.
|
clone, equals, finalize, getClass, hashCode, notify,
notifyAll, toString, wait, wait, wait
initializeListener
public addQueryBatchSuccessInformationListener()
public void processEvent(QueryBatch batch)
QueryBatchListener
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);
processEvent
in interface BatchListener<QueryBatch>
processEvent
in interface QueryBatchListener
batch
- the batch of uris and some metadata about
the current status of the jobCopyright © 2013-2019 MarkLogic Corporation.