public static class BulkProcessor.Builder
extends java.lang.Object
Constructor and Description |
---|
Builder(java.util.function.BiConsumer<BulkRequest,ActionListener<BulkResponse>> consumer,
BulkProcessor.Listener listener,
ThreadPool threadPool)
Creates a builder of bulk processor with the client to use and the listener that will be used
to be notified on the completion of bulk requests.
|
Modifier and Type | Method and Description |
---|---|
BulkProcessor |
build()
Builds a new bulk processor.
|
BulkProcessor.Builder |
setBackoffPolicy(BackoffPolicy backoffPolicy)
Sets a custom backoff policy.
|
BulkProcessor.Builder |
setBulkActions(int bulkActions)
Sets when to flush a new bulk request based on the number of actions currently added.
|
BulkProcessor.Builder |
setBulkSize(ByteSizeValue bulkSize)
Sets when to flush a new bulk request based on the size of actions currently added.
|
BulkProcessor.Builder |
setConcurrentRequests(int concurrentRequests)
Sets the number of concurrent requests allowed to be executed.
|
BulkProcessor.Builder |
setFlushInterval(TimeValue flushInterval)
Sets a flush interval flushing *any* bulk actions pending if the interval passes.
|
public Builder(java.util.function.BiConsumer<BulkRequest,ActionListener<BulkResponse>> consumer, BulkProcessor.Listener listener, ThreadPool threadPool)
public BulkProcessor.Builder setConcurrentRequests(int concurrentRequests)
public BulkProcessor.Builder setBulkActions(int bulkActions)
public BulkProcessor.Builder setBulkSize(ByteSizeValue bulkSize)
public BulkProcessor.Builder setFlushInterval(TimeValue flushInterval)
Note, both setBulkActions(int)
and setBulkSize(org.elasticsearch.common.unit.ByteSizeValue)
can be set to -1 with the flush interval set allowing for complete async processing of bulk actions.
public BulkProcessor.Builder setBackoffPolicy(BackoffPolicy backoffPolicy)
BackoffPolicy.exponentialBackoff()
public BulkProcessor build()