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 DynamoEventSource
        • 10000 for KinesisEventSource, ManagedKafkaEventSource and 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) for Kinesis, DynamoDB, and SQS event sources, Duration.millis(500) for MSK, self-managed Kafka, and Amazon MQ.

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

      @Stability(Stable) public KinesisEventSource.Builder provisionedPollerConfig(ProvisionedPollerConfig provisionedPollerConfig)
      Configuration for provisioned pollers that read from the event source.

      When specified, allows control over the minimum and maximum number of pollers that can be provisioned to process events from the source.

      Default: - no provisioned pollers

      Parameters:
      provisionedPollerConfig - Configuration for provisioned pollers that read from the event source. 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
    • filterEncryption

      @Stability(Stable) public KinesisEventSource.Builder filterEncryption(IKey filterEncryption)
      Add Customer managed KMS key to encrypt Filter Criteria.

      Default: - none

      Parameters:
      filterEncryption - Add Customer managed KMS key to encrypt Filter Criteria. This parameter is required.
      Returns:
      this
      See Also:
    • filters

      @Stability(Stable) public KinesisEventSource.Builder filters(List<? extends Map<String,? extends Object>> filters)
      Add filter criteria option.

      Default: - None

      Parameters:
      filters - Add filter criteria option. 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

      The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, Lambda never discards old records. Record are valid until it expires in the event source.

      Default: -1

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

      @Stability(Stable) public KinesisEventSource.Builder metricsConfig(MetricsConfig metricsConfig)
      Configuration for enhanced monitoring metrics collection When specified, enables collection of additional metrics for the stream event source.

      Default: - Enhanced monitoring is disabled

      Parameters:
      metricsConfig - Configuration for enhanced monitoring metrics collection When specified, enables collection of additional metrics for the stream event source. 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.

      The default value is -1, which sets the maximum number of retries to infinite. When MaximumRetryAttempts is infinite, Lambda retries failed records until the record expires in the event source.

      Default: -1

      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
    • startingPositionTimestamp

      @Stability(Stable) public KinesisEventSource.Builder startingPositionTimestamp(Number startingPositionTimestamp)
      The time from which to start reading, in Unix time seconds.

      Default: - no timestamp

      Parameters:
      startingPositionTimestamp - The time from which to start reading, in Unix time seconds. This parameter is required.
      Returns:
      this
    • build

      @Stability(Stable) public KinesisEventSource build()
      Specified by:
      build in interface software.amazon.jsii.Builder<KinesisEventSource>
      Returns:
      a newly built instance of KinesisEventSource.