BatchListener<WriteBatch>
,
WriteBatchListener
public class JobInformationRecorder.addWriteBatchSuccessInformationListener extends java.lang.Object implements WriteBatchListener
Constructor | Description |
---|---|
addWriteBatchSuccessInformationListener() |
Modifier and Type | Method | Description |
---|---|---|
void |
processEvent(WriteBatch batch) |
The method called by WriteBatcher to run your
custom code on this batch.
|
public addWriteBatchSuccessInformationListener()
public void processEvent(WriteBatch batch)
WriteBatchListener
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>
processEvent
in interface WriteBatchListener
batch
- the batch of documents written and some
metadata about the current status of the jobCopyright © 2022 MarkLogic Corporation