Interface BulkListener<Context>
- Type Parameters:
Context- application-defined contextual data that can be associated to a bulk operation.
public interface BulkListener<Context>
A listener that is called by a
BulkIngester to allow monitoring requests sent and their result.-
Method Summary
Modifier and TypeMethodDescriptionvoidafterBulk(long executionId, BulkRequest request, List<Context> contexts, BulkResponse response) Called after a bulk request has been processed.voidafterBulk(long executionId, BulkRequest request, List<Context> contexts, Throwable failure) Called when a bulk request could not be sent to Elasticsearch.voidbeforeBulk(long executionId, BulkRequest request, List<Context> contexts) Called before a bulk request is sent.
-
Method Details
-
beforeBulk
Called before a bulk request is sent. Note: documents inrequestoperations have been converted toBinaryData.- Parameters:
executionId- the id of this request, unique for theBulkIngesterthat created it.request- the bulk request that will be sent, with documents in binary form.contexts- application-defined data that was passed inBulkIngester.add(BulkOperation, Object).
-
afterBulk
void afterBulk(long executionId, BulkRequest request, List<Context> contexts, BulkResponse response) Called after a bulk request has been processed. Elasticsearch accepted the request, butresponsethe response may contain both successful and failure response items.- Parameters:
executionId- the id of this request, unique for theBulkIngesterthat created it.request- the bulk request that will be sent, with documents in binary form.contexts- application-defined data that was passed inBulkIngester.add(BulkOperation, Object).response- the response received from Elasticsearch.
-
afterBulk
Called when a bulk request could not be sent to Elasticsearch.- Parameters:
executionId- the id of this request, unique for theBulkIngesterthat created it.request- the bulk request that will be sent, with documents in binary form.contexts- application-defined data that was passed inBulkIngester.add(BulkOperation, Object).failure- the failure that occurred when sending the request to Elasticsearch.
-