Class ElasticsearchSinkBuilderBase<IN,B extends ElasticsearchSinkBuilderBase<IN,B>>
- java.lang.Object
-
- org.apache.flink.connector.elasticsearch.sink.ElasticsearchSinkBuilderBase<IN,B>
-
- Type Parameters:
IN- type of the records converted to Elasticsearch actions
@PublicEvolving public abstract class ElasticsearchSinkBuilderBase<IN,B extends ElasticsearchSinkBuilderBase<IN,B>> extends Object
Base builder to construct aElasticsearchSink.
-
-
Field Summary
Fields Modifier and Type Field Description protected ElasticsearchEmitter<? super IN>emitter
-
Constructor Summary
Constructors Modifier Constructor Description protectedElasticsearchSinkBuilderBase()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ElasticsearchSink<IN>build()Constructs theElasticsearchSinkwith the properties configured this builder.protected abstract org.apache.flink.connector.elasticsearch.sink.BulkProcessorBuilderFactorygetBulkProcessorBuilderFactory()protected <S extends ElasticsearchSinkBuilderBase<?,?>>
Sself()BsetBulkFlushBackoffStrategy(FlushBackoffType flushBackoffType, int maxRetries, long delayMillis)Sets the type of back off to use when flushing bulk requests.BsetBulkFlushInterval(long intervalMillis)Sets the bulk flush interval, in milliseconds.BsetBulkFlushMaxActions(int numMaxActions)Sets the maximum number of actions to buffer for each bulk request.BsetBulkFlushMaxSizeMb(int maxSizeMb)Sets the maximum size of buffered actions, in mb, per bulk request.BsetConnectionPassword(String password)Sets the password used to authenticate the connection with the Elasticsearch cluster.BsetConnectionPathPrefix(String prefix)Sets a prefix which used for every REST communication to the Elasticsearch cluster.BsetConnectionRequestTimeout(int timeout)Sets the timeout for requesting the connection of the Elasticsearch cluster from the connection manager.BsetConnectionTimeout(int timeout)Sets the timeout for establishing a connection of the Elasticsearch cluster.BsetConnectionUsername(String username)Sets the username used to authenticate the connection with the Elasticsearch cluster.BsetDeliveryGuarantee(org.apache.flink.connector.base.DeliveryGuarantee deliveryGuarantee)Sets the wantedDeliveryGuarantee.<T extends IN>
ElasticsearchSinkBuilderBase<T,?>setEmitter(ElasticsearchEmitter<? super T> emitter)Sets the emitter which is invoked on every record to convert it to Elasticsearch actions.BsetHosts(org.apache.http.HttpHost... hosts)Sets the hosts where the Elasticsearch cluster nodes are reachable.BsetSocketTimeout(int timeout)Sets the timeout for waiting for data or, put differently, a maximum period inactivity between two consecutive data packets.StringtoString()
-
-
-
Field Detail
-
emitter
protected ElasticsearchEmitter<? super IN> emitter
-
-
Method Detail
-
self
protected <S extends ElasticsearchSinkBuilderBase<?,?>> S self()
-
setEmitter
public <T extends IN> ElasticsearchSinkBuilderBase<T,?> setEmitter(ElasticsearchEmitter<? super T> emitter)
Sets the emitter which is invoked on every record to convert it to Elasticsearch actions.- Parameters:
emitter- to process records into Elasticsearch actions.- Returns:
- this builder
-
setHosts
public B setHosts(org.apache.http.HttpHost... hosts)
Sets the hosts where the Elasticsearch cluster nodes are reachable.- Parameters:
hosts- http addresses describing the node locations- Returns:
- this builder
-
setDeliveryGuarantee
public B setDeliveryGuarantee(org.apache.flink.connector.base.DeliveryGuarantee deliveryGuarantee)
Sets the wantedDeliveryGuarantee. The default delivery guarantee isDeliveryGuarantee.NONE- Parameters:
deliveryGuarantee- which describes the record emission behaviour- Returns:
- this builder
-
setBulkFlushMaxActions
public B setBulkFlushMaxActions(int numMaxActions)
Sets the maximum number of actions to buffer for each bulk request. You can pass -1 to disable it. The default flush size 1000.- Parameters:
numMaxActions- the maximum number of actions to buffer per bulk request.- Returns:
- this builder
-
setBulkFlushMaxSizeMb
public B setBulkFlushMaxSizeMb(int maxSizeMb)
Sets the maximum size of buffered actions, in mb, per bulk request. You can pass -1 to disable it.- Parameters:
maxSizeMb- the maximum size of buffered actions, in mb.- Returns:
- this builder
-
setBulkFlushInterval
public B setBulkFlushInterval(long intervalMillis)
Sets the bulk flush interval, in milliseconds. You can pass -1 to disable it.- Parameters:
intervalMillis- the bulk flush interval, in milliseconds.- Returns:
- this builder
-
setBulkFlushBackoffStrategy
public B setBulkFlushBackoffStrategy(FlushBackoffType flushBackoffType, int maxRetries, long delayMillis)
Sets the type of back off to use when flushing bulk requests. The default bulk flush back off type isFlushBackoffType.NONE.Sets the amount of delay between each backoff attempt when flushing bulk requests, in milliseconds.
Sets the maximum number of retries for a backoff attempt when flushing bulk requests.
- Parameters:
flushBackoffType- the backoff type to use.- Returns:
- this builder
-
setConnectionUsername
public B setConnectionUsername(String username)
Sets the username used to authenticate the connection with the Elasticsearch cluster.- Parameters:
username- of the Elasticsearch cluster user- Returns:
- this builder
-
setConnectionPassword
public B setConnectionPassword(String password)
Sets the password used to authenticate the connection with the Elasticsearch cluster.- Parameters:
password- of the Elasticsearch cluster user- Returns:
- this builder
-
setConnectionPathPrefix
public B setConnectionPathPrefix(String prefix)
Sets a prefix which used for every REST communication to the Elasticsearch cluster.- Parameters:
prefix- for the communication- Returns:
- this builder
-
setConnectionRequestTimeout
public B setConnectionRequestTimeout(int timeout)
Sets the timeout for requesting the connection of the Elasticsearch cluster from the connection manager.- Parameters:
timeout- for the connection request- Returns:
- this builder
-
setConnectionTimeout
public B setConnectionTimeout(int timeout)
Sets the timeout for establishing a connection of the Elasticsearch cluster.- Parameters:
timeout- for the connection- Returns:
- this builder
-
setSocketTimeout
public B setSocketTimeout(int timeout)
Sets the timeout for waiting for data or, put differently, a maximum period inactivity between two consecutive data packets.- Parameters:
timeout- for the socket- Returns:
- this builder
-
getBulkProcessorBuilderFactory
protected abstract org.apache.flink.connector.elasticsearch.sink.BulkProcessorBuilderFactory getBulkProcessorBuilderFactory()
-
build
public ElasticsearchSink<IN> build()
Constructs theElasticsearchSinkwith the properties configured this builder.- Returns:
ElasticsearchSink
-
-