public interface QueryBatchListener extends BatchListener<QueryBatch>
processEvent
Modifier and Type | Method and Description |
---|---|
default void |
initializeListener(QueryBatcher queryBatcher)
This default method should be implemented by
custom listeners that should be retried in case of failover.
|
void |
processEvent(QueryBatch batch)
The method called by QueryBatcher or
WriteBatcher to run your custom code on this batch.
|
void processEvent(QueryBatch 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, 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>
batch
- the batch of uris and some metadata about
the current status of the jobdefault void initializeListener(QueryBatcher queryBatcher)
queryBatcher
- the QueryBatcher which will call
this ListenerCopyright © 2024 MarkLogic Corporation. All Rights Reserved.