Class SimpleBatchCreator<RequestEntryT extends Serializable>
- java.lang.Object
-
- org.apache.flink.connector.base.sink.writer.SimpleBatchCreator<RequestEntryT>
-
- Type Parameters:
RequestEntryT- the type of request entries managed by this batch creator
- All Implemented Interfaces:
BatchCreator<RequestEntryT>
@Internal public class SimpleBatchCreator<RequestEntryT extends Serializable> extends Object implements BatchCreator<RequestEntryT>
A simple implementation ofBatchCreatorthat forms a batch by taking up torequestInfo.getBatchSize()entries from the head of the buffer, so long as the cumulative size in bytes does not exceed the configured maximum.This strategy stops gathering entries from the buffer as soon as adding the next entry would exceed the
maxBatchSizeInBytes, or once it has collectedrequestInfo.getBatchSize()entries, whichever occurs first.
-
-
Constructor Summary
Constructors Constructor Description SimpleBatchCreator(long maxBatchSizeInBytes)Constructs aSimpleBatchCreatorwith the specified maximum batch size in bytes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Batch<RequestEntryT>createNextBatch(RequestInfo requestInfo, RequestBuffer<RequestEntryT> bufferedRequestEntries)Creates the next batch of request entries based on the providedrequestInfoand the currently buffered entries.
-
-
-
Method Detail
-
createNextBatch
public Batch<RequestEntryT> createNextBatch(RequestInfo requestInfo, RequestBuffer<RequestEntryT> bufferedRequestEntries)
Creates the next batch of request entries based on the providedrequestInfoand the currently buffered entries.- Specified by:
createNextBatchin interfaceBatchCreator<RequestEntryT extends Serializable>- Parameters:
requestInfo- information about the desired request properties or constraints (e.g., an allowed batch size or other relevant hints)bufferedRequestEntries- a collection ex:Dequeof all currently buffered entries waiting to be grouped into batches- Returns:
- a
Batchcontaining the new batch of entries along with metadata about the batch (e.g., total byte size, record count)
-
-