public interface WriteBatchListener extends BatchListener<WriteBatch>
processEvent
Modifier and Type | Method and Description |
---|---|
void |
processEvent(WriteBatch batch)
The method called by WriteBatcher to run your
custom code on this batch.
|
void processEvent(WriteBatch batch)
The method called by 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 onBatchSuccess:
WriteBatcher wb = dataMovementManager.newWriteBatcher(query)
.withBatchSize(1000)
.withThreadCount(20)
.onBatchSuccess(batch -> {
for ( WriteEvent doc : batch.getItems() ) {
if ( doc.getTargetUri().contains("/legal/") ) {
// do something
}
}
})
.onBatchFailure(throwable -> throwable.printStackTrace());
processEvent
in interface BatchListener<WriteBatch>
batch
- the batch of documents written and some
metadata about the current status of the jobCopyright © 2024 MarkLogic Corporation. All Rights Reserved.