pyflink.datastream.connectors.kinesis.KinesisStreamsSinkBuilder#
- class KinesisStreamsSinkBuilder[source]#
Builder to construct KinesisStreamsSink.
The following example shows the minimum setup to create a KinesisStreamsSink that writes String values to a Kinesis Data Streams stream named your_stream_here.
Example:
>>> from pyflink.common.serialization import SimpleStringSchema >>> sink_properties = {"aws.region": "eu-west-1"} >>> sink = KinesisStreamsSink.builder() \ ... .set_kinesis_client_properties(sink_properties) \ ... .set_stream_name("your_stream_name") \ ... .set_serialization_schema(SimpleStringSchema()) \ ... .set_partition_key_generator(PartitionKeyGenerator.random()) \ ... .build()
If the following parameters are not set in this builder, the following defaults will be used:
maxBatchSize will be 500
maxInFlightRequests will be 50
maxBufferedRequests will be 10000
maxBatchSizeInBytes will be 5 MB i.e. 5 * 1024 * 1024
maxTimeInBufferMS will be 5000ms
maxRecordSizeInBytes will be 1 MB i.e. 1 * 1024 * 1024
failOnError will be false
Methods
build
()Build thd KinesisStreamsSink.
set_fail_on_error
(fail_on_error)Sets the failOnError of the KinesisSinkBuilder.
set_kinesis_client_properties
(...)Sets the kinesisClientProperties of the KinesisSinkBuilder.
set_max_batch_size
(max_batch_size)Maximum number of elements that may be passed in a list to be written downstream.
set_max_batch_size_in_bytes
(...)The 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.
set_max_buffered_requests
(max_buffered_requests)The maximum buffer length.
set_max_in_flight_requests
(...)Maximum number of uncompleted calls to submitRequestEntries that the SinkWriter will allow at any given point.
set_max_record_size_in_bytes
(...)The maximum size of each records in bytes.
set_max_time_in_buffer_ms
(max_time_in_buffer_ms)The maximum amount of time an element may remain in the buffer.
set_partition_key_generator
(...)Sets the PartitionKeyGenerator of the KinesisSinkBuilder.
set_serialization_schema
(serialization_schema)Sets the SerializationSchema of the KinesisSinkBuilder.
set_stream_name
(stream_name)Sets the name of the KDS stream that the sink will connect to.