public class DeleteListener extends Object implements QueryBatchListener
Sends a Java API bulk delete request for all the documents from each batch. Because it deletes documents, it should only be used when:
QueryBatcher.withConsistentSnapshot() is called, ornewQueryBatcher(Iterator<String>) is used to traverse a static data setWhen merge timestamp is enabled, pass a DeleteListener instance to QueryBatcher onUrisReady like so:
QueryBatcher deleteBatcher = moveMgr.newQueryBatcher(query)
.onUrisReady(new DeleteListener())
.withConsistentSnapshot();
JobTicket ticket = moveMgr.startJob(deleteBatcher);
deleteBatcher.awaitCompletion();
moveMgr.stopJob(ticket);
With Iterator
QueryBatcher deleteBatcher = moveMgr.newQueryBatcher(query)
.onUrisReady(new DeleteListener());
JobTicket ticket = moveMgr.startJob(deleteBatcher);
deleteBatcher.awaitCompletion();
moveMgr.stopJob(ticket);
As with all the provided listeners, this listener will not meet the needs of all applications but the source code for it should serve as helpful sample code so you can write your own custom listeners.
| Constructor and Description |
|---|
DeleteListener() |
| Modifier and Type | Method and Description |
|---|---|
DeleteListener |
onBatchFailure(BatchFailureListener<Batch<String>> listener)
When a batch fails or a callback throws an Exception, run this listener code.
|
void |
processEvent(QueryBatch batch)
The standard BatchListener action called by QueryBatcher.
|
public void processEvent(QueryBatch batch)
The standard BatchListener action called by QueryBatcher.
processEvent in interface BatchListener<QueryBatch>processEvent in interface QueryBatchListenerbatch - the batch of uris and some metadata about the current status of the jobpublic DeleteListener onBatchFailure(BatchFailureListener<Batch<String>> listener)
When a batch fails or a callback throws an Exception, run this listener code. Multiple listeners can be registered with this method.
listener - the code to run when a failure occursCopyright © 2013-2017 MarkLogic Corporation.