Class KinesisStreamsSink<InputT>

  • Type Parameters:
    InputT - Type of the elements handled by this sink
    All Implemented Interfaces:
    Serializable, org.apache.flink.api.connector.sink2.Sink<InputT>, org.apache.flink.api.connector.sink2.StatefulSink<InputT,​org.apache.flink.connector.base.sink.writer.BufferedRequestState<software.amazon.awssdk.services.kinesis.model.PutRecordsRequestEntry>>

    @PublicEvolving
    public class KinesisStreamsSink<InputT>
    extends org.apache.flink.connector.base.sink.AsyncSinkBase<InputT,​software.amazon.awssdk.services.kinesis.model.PutRecordsRequestEntry>
    A Kinesis Data Streams (KDS) Sink that performs async requests against a destination stream using the buffering protocol specified in AsyncSinkBase.

    The sink internally uses a KinesisAsyncClient to communicate with the AWS endpoint.

    The behaviour of the buffering may be specified by providing configuration during the sink build time.

    • maxBatchSize: the maximum size of a batch of entries that may be sent to KDS
    • maxInFlightRequests: the maximum number of in flight requests that may exist, if any more in flight requests need to be initiated once the maximum has been reached, then it will be blocked until some have completed
    • maxBufferedRequests: the maximum number of elements held in the buffer, requests to add elements will be blocked while the number of elements in the buffer is at the maximum
    • maxBatchSizeInBytes: the maximum size of a batch of entries that may be sent to KDS measured in bytes
    • maxTimeInBufferMS: the maximum amount of time an entry is allowed to live in the buffer, if any element reaches this age, the entire buffer will be flushed immediately
    • maxRecordSizeInBytes: the maximum size of a record the sink will accept into the buffer, a record of size larger than this will be rejected when passed to the sink
    • failOnError: when an exception is encountered while persisting to Kinesis Data Streams, the job will fail immediately if failOnError is set

    Please see the writer implementation in KinesisStreamsSinkWriter

    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.apache.flink.api.connector.sink2.Sink

        org.apache.flink.api.connector.sink2.Sink.InitContext
      • Nested classes/interfaces inherited from interface org.apache.flink.api.connector.sink2.StatefulSink

        org.apache.flink.api.connector.sink2.StatefulSink.StatefulSinkWriter<InputT extends Object,​WriterStateT extends Object>, org.apache.flink.api.connector.sink2.StatefulSink.WithCompatibleState
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static <InputT> KinesisStreamsSinkBuilder<InputT> builder()
      Create a KinesisStreamsSinkBuilder to allow the fluent construction of a new KinesisStreamsSink.
      org.apache.flink.api.connector.sink2.StatefulSink.StatefulSinkWriter<InputT,​org.apache.flink.connector.base.sink.writer.BufferedRequestState<software.amazon.awssdk.services.kinesis.model.PutRecordsRequestEntry>> createWriter​(org.apache.flink.api.connector.sink2.Sink.InitContext context)  
      org.apache.flink.core.io.SimpleVersionedSerializer<org.apache.flink.connector.base.sink.writer.BufferedRequestState<software.amazon.awssdk.services.kinesis.model.PutRecordsRequestEntry>> getWriterStateSerializer()  
      org.apache.flink.api.connector.sink2.StatefulSink.StatefulSinkWriter<InputT,​org.apache.flink.connector.base.sink.writer.BufferedRequestState<software.amazon.awssdk.services.kinesis.model.PutRecordsRequestEntry>> restoreWriter​(org.apache.flink.api.connector.sink2.Sink.InitContext context, Collection<org.apache.flink.connector.base.sink.writer.BufferedRequestState<software.amazon.awssdk.services.kinesis.model.PutRecordsRequestEntry>> recoveredState)  
      • Methods inherited from class org.apache.flink.connector.base.sink.AsyncSinkBase

        getElementConverter, getMaxBatchSize, getMaxBatchSizeInBytes, getMaxBufferedRequests, getMaxInFlightRequests, getMaxRecordSizeInBytes, getMaxTimeInBufferMS
    • Method Detail

      • createWriter

        @Internal
        public org.apache.flink.api.connector.sink2.StatefulSink.StatefulSinkWriter<InputT,​org.apache.flink.connector.base.sink.writer.BufferedRequestState<software.amazon.awssdk.services.kinesis.model.PutRecordsRequestEntry>> createWriter​(org.apache.flink.api.connector.sink2.Sink.InitContext context)
                                                                                                                                                                                                                                               throws IOException
        Throws:
        IOException
      • getWriterStateSerializer

        @Internal
        public org.apache.flink.core.io.SimpleVersionedSerializer<org.apache.flink.connector.base.sink.writer.BufferedRequestState<software.amazon.awssdk.services.kinesis.model.PutRecordsRequestEntry>> getWriterStateSerializer()
      • restoreWriter

        @Internal
        public org.apache.flink.api.connector.sink2.StatefulSink.StatefulSinkWriter<InputT,​org.apache.flink.connector.base.sink.writer.BufferedRequestState<software.amazon.awssdk.services.kinesis.model.PutRecordsRequestEntry>> restoreWriter​(org.apache.flink.api.connector.sink2.Sink.InitContext context,
                                                                                                                                                                                                                                                       Collection<org.apache.flink.connector.base.sink.writer.BufferedRequestState<software.amazon.awssdk.services.kinesis.model.PutRecordsRequestEntry>> recoveredState)
                                                                                                                                                                                                                                                throws IOException
        Throws:
        IOException