Class KinesisEventSource.Builder

java.lang.Object
software.amazon.awscdk.services.lambda.eventsources.KinesisEventSource.Builder
All Implemented Interfaces:
software.amazon.jsii.Builder<KinesisEventSource>
Enclosing class:
KinesisEventSource

@Stability(Stable) public static final class KinesisEventSource.Builder extends Object implements software.amazon.jsii.Builder<KinesisEventSource>
A fluent builder for KinesisEventSource.
  • Method Details

    • create

      @Stability(Stable) public static KinesisEventSource.Builder create(IStream stream)
      Parameters:
      stream - This parameter is required.
      Returns:
      a new instance of KinesisEventSource.Builder.
    • startingPosition

      @Stability(Stable) public KinesisEventSource.Builder startingPosition(StartingPosition startingPosition)
      Where to begin consuming the stream.

      Parameters:
      startingPosition - Where to begin consuming the stream. This parameter is required.
      Returns:
      this
    • batchSize

      @Stability(Stable) public KinesisEventSource.Builder batchSize(Number batchSize)
      The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function.

      Your function receives an event with all the retrieved records.

      Valid Range:

      • Minimum value of 1
      • Maximum value of:

        • 1000 for {@link DynamoEventSource}
        • 10000 for {@link KinesisEventSource}, {@link ManagedKafkaEventSource} and {@link SelfManagedKafkaEventSource}

      Default: 100

      Parameters:
      batchSize - The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. This parameter is required.
      Returns:
      this
    • enabled

      @Stability(Stable) public KinesisEventSource.Builder enabled(Boolean enabled)
      If the stream event source mapping should be enabled.

      Default: true

      Parameters:
      enabled - If the stream event source mapping should be enabled. This parameter is required.
      Returns:
      this
    • maxBatchingWindow

      @Stability(Stable) public KinesisEventSource.Builder maxBatchingWindow(Duration maxBatchingWindow)
      The maximum amount of time to gather records before invoking the function.

      Maximum of Duration.minutes(5)

      Default: Duration.seconds(0)

      Parameters:
      maxBatchingWindow - The maximum amount of time to gather records before invoking the function. This parameter is required.
      Returns:
      this
    • bisectBatchOnError

      @Stability(Stable) public KinesisEventSource.Builder bisectBatchOnError(Boolean bisectBatchOnError)
      If the function returns an error, split the batch in two and retry.

      Default: false

      Parameters:
      bisectBatchOnError - If the function returns an error, split the batch in two and retry. This parameter is required.
      Returns:
      this
    • maxRecordAge

      @Stability(Stable) public KinesisEventSource.Builder maxRecordAge(Duration maxRecordAge)
      The maximum age of a record that Lambda sends to a function for processing.

      Valid Range:

      • Minimum value of 60 seconds
      • Maximum value of 7 days

      Default: - the retention period configured on the stream

      Parameters:
      maxRecordAge - The maximum age of a record that Lambda sends to a function for processing. This parameter is required.
      Returns:
      this
    • onFailure

      @Stability(Stable) public KinesisEventSource.Builder onFailure(IEventSourceDlq onFailure)
      An Amazon SQS queue or Amazon SNS topic destination for discarded records.

      Default: - discarded records are ignored

      Parameters:
      onFailure - An Amazon SQS queue or Amazon SNS topic destination for discarded records. This parameter is required.
      Returns:
      this
    • parallelizationFactor

      @Stability(Stable) public KinesisEventSource.Builder parallelizationFactor(Number parallelizationFactor)
      The number of batches to process from each shard concurrently.

      Valid Range:

      • Minimum value of 1
      • Maximum value of 10

      Default: 1

      Parameters:
      parallelizationFactor - The number of batches to process from each shard concurrently. This parameter is required.
      Returns:
      this
    • reportBatchItemFailures

      @Stability(Stable) public KinesisEventSource.Builder reportBatchItemFailures(Boolean reportBatchItemFailures)
      Allow functions to return partially successful responses for a batch of records.

      Default: false

      Parameters:
      reportBatchItemFailures - Allow functions to return partially successful responses for a batch of records. This parameter is required.
      Returns:
      this
      See Also:
    • retryAttempts

      @Stability(Stable) public KinesisEventSource.Builder retryAttempts(Number retryAttempts)
      Maximum number of retry attempts Valid Range: * Minimum value of 0 * Maximum value of 10000.

      Default: - retry until the record expires

      Parameters:
      retryAttempts - Maximum number of retry attempts Valid Range: * Minimum value of 0 * Maximum value of 10000. This parameter is required.
      Returns:
      this
    • tumblingWindow

      @Stability(Stable) public KinesisEventSource.Builder tumblingWindow(Duration tumblingWindow)
      The size of the tumbling windows to group records sent to DynamoDB or Kinesis Valid Range: 0 - 15 minutes.

      Default: - None

      Parameters:
      tumblingWindow - The size of the tumbling windows to group records sent to DynamoDB or Kinesis Valid Range: 0 - 15 minutes. This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public KinesisEventSource build()
      Specified by:
      build in interface software.amazon.jsii.Builder<KinesisEventSource>