Class AsyncSinkBaseBuilder<InputT,RequestEntryT extends Serializable,ConcreteBuilderT extends AsyncSinkBaseBuilder<?,?,?>>
- java.lang.Object
-
- org.apache.flink.connector.base.sink.AsyncSinkBaseBuilder<InputT,RequestEntryT,ConcreteBuilderT>
-
- Type Parameters:
InputT- type of elements that should be persisted in the destinationRequestEntryT- type of payload that contains the element and additional metadata that is required to submit a single element to the destinationConcreteBuilderT- type of concrete implementation of this builder class
@PublicEvolving public abstract class AsyncSinkBaseBuilder<InputT,RequestEntryT extends Serializable,ConcreteBuilderT extends AsyncSinkBaseBuilder<?,?,?>> extends Object
Abstract builder for constructing a concrete implementation ofAsyncSinkBase.
-
-
Constructor Summary
Constructors Constructor Description AsyncSinkBaseBuilder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract AsyncSinkBase<InputT,RequestEntryT>build()Builds the Sink with the settings applied to this builder.protected IntegergetMaxBatchSize()protected LonggetMaxBatchSizeInBytes()protected IntegergetMaxBufferedRequests()protected IntegergetMaxInFlightRequests()protected LonggetMaxRecordSizeInBytes()protected LonggetMaxTimeInBufferMS()ConcreteBuilderTsetMaxBatchSize(int maxBatchSize)ConcreteBuilderTsetMaxBatchSizeInBytes(long maxBatchSizeInBytes)ConcreteBuilderTsetMaxBufferedRequests(int maxBufferedRequests)ConcreteBuilderTsetMaxInFlightRequests(int maxInFlightRequests)ConcreteBuilderTsetMaxRecordSizeInBytes(long maxRecordSizeInBytes)ConcreteBuilderTsetMaxTimeInBufferMS(long maxTimeInBufferMS)
-
-
-
Method Detail
-
setMaxBatchSize
public ConcreteBuilderT setMaxBatchSize(int maxBatchSize)
- Parameters:
maxBatchSize- maximum number of elements that may be passed in a list to be written downstream.- Returns:
AsyncSinkBaseBuilderitself
-
setMaxInFlightRequests
public ConcreteBuilderT setMaxInFlightRequests(int maxInFlightRequests)
- Parameters:
maxInFlightRequests- maximum number of uncompleted calls to submitRequestEntries that the SinkWriter will allow at any given point. Once this point has reached, writes and callbacks to add elements to the buffer may block until one or more requests to submitRequestEntries completes.- Returns:
AsyncSinkBaseBuilderitself
-
setMaxBufferedRequests
public ConcreteBuilderT setMaxBufferedRequests(int maxBufferedRequests)
- Parameters:
maxBufferedRequests- the maximum buffer length. Callbacks to add elements to the buffer and calls to write will block if this length has been reached and will only unblock if elements from the buffer have been removed for flushing.- Returns:
AsyncSinkBaseBuilderitself
-
setMaxBatchSizeInBytes
public ConcreteBuilderT setMaxBatchSizeInBytes(long maxBatchSizeInBytes)
- Parameters:
maxBatchSizeInBytes- a flush will be attempted if the most recent call to write introduces an element to the buffer such that the total size of the buffer is greater than or equal to this threshold value. If this happens, the maximum number of elements from the head of the buffer will be selected, that is smaller thanmaxBatchSizeInBytesin size will be flushed.- Returns:
AsyncSinkBaseBuilderitself
-
setMaxTimeInBufferMS
public ConcreteBuilderT setMaxTimeInBufferMS(long maxTimeInBufferMS)
- Parameters:
maxTimeInBufferMS- the maximum amount of time an element may remain in the buffer. In most cases elements are flushed as a result of the batch size (in bytes or number) being reached or during a snapshot. However, there are scenarios where an element may remain in the buffer forever or a long period of time. To mitigate this, a timer is constantly active in the buffer such that: while the buffer is not empty, it will flush every maxTimeInBufferMS milliseconds.- Returns:
AsyncSinkBaseBuilderitself
-
setMaxRecordSizeInBytes
public ConcreteBuilderT setMaxRecordSizeInBytes(long maxRecordSizeInBytes)
- Parameters:
maxRecordSizeInBytes- the maximum size of each records in bytes. If a record larger than this is passed to the sink, it will throw anIllegalArgumentException.- Returns:
AsyncSinkBaseBuilderitself
-
build
public abstract AsyncSinkBase<InputT,RequestEntryT> build()
Builds the Sink with the settings applied to this builder.
-
getMaxBatchSize
protected Integer getMaxBatchSize()
-
getMaxInFlightRequests
protected Integer getMaxInFlightRequests()
-
getMaxBufferedRequests
protected Integer getMaxBufferedRequests()
-
getMaxBatchSizeInBytes
protected Long getMaxBatchSizeInBytes()
-
getMaxTimeInBufferMS
protected Long getMaxTimeInBufferMS()
-
getMaxRecordSizeInBytes
protected Long getMaxRecordSizeInBytes()
-
-