producer

AWS Kinesis Data Streams producer implementation.

class unistream_aws_kinesis.producer.AwsKinesisStreamProducer(buffer: AbcBuffer = REQ, retry_config: RetryConfig = REQ, kinesis_client: KinesisClient = REQ, stream_name: str = REQ)[source]

Producer that sends records to an AWS Kinesis Data Stream.

Uses kinesis_client.put_records() to send batches of records.

Parameters:
  • kinesis_client – A boto3 Kinesis client.

  • stream_name – The name of the Kinesis stream.

Note

The PutRecords API accepts at most 500 records per request and 5 MB per request, with a per-shard write limit of 1,000 records/sec and 1 MB/sec (see Kinesis Quotas). When constructing the buffer, make sure max_records <= 500 and max_bytes does not exceed 5 MB (5_000_000) to stay within a single PutRecords call limit.

classmethod new(buffer: T_BUFFER, retry_config: RetryConfig, kinesis_client: KinesisClient, stream_name: str)[source]

Create an AwsKinesisStreamProducer instance.

Parameters:
  • buffer – Buffer for batching records.

  • retry_config – Retry configuration for send failures.

  • kinesis_client – A boto3 Kinesis client.

  • stream_name – The name of the Kinesis stream.

send(records: list[T_RECORD])[source]

Send records to AWS Kinesis Data Stream via put_records.