BatchListener<QueryBatch>ApplyTransformListener, DeleteListener, ExportListener, ExportToWriterListener, ExtractRowsViaTemplateListener, JobInformationRecorder.addQueryBatchSuccessInformationListener, OpticExportListener, OpticExportToWriterListener, ProgressListener, UrisToWriterListenerpublic interface QueryBatchListener extends BatchListener<QueryBatch>
processEvent| Modifier and Type | Method | 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 © 2013-2021 MarkLogic Corporation.