Class ManagedKafkaEventSource.Builder

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

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

    • create

      @Stability(Stable) public static ManagedKafkaEventSource.Builder create()
      Returns:
      a new instance of ManagedKafkaEventSource.Builder.
    • startingPosition

      @Stability(Stable) public ManagedKafkaEventSource.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 ManagedKafkaEventSource.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 ManagedKafkaEventSource.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 ManagedKafkaEventSource.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:
    • topic

      @Stability(Stable) public ManagedKafkaEventSource.Builder topic(String topic)
      The Kafka topic to subscribe to.

      Parameters:
      topic - The Kafka topic to subscribe to. This parameter is required.
      Returns:
      this
    • consumerGroupId

      @Stability(Stable) public ManagedKafkaEventSource.Builder consumerGroupId(String consumerGroupId)
      The identifier for the Kafka consumer group to join.

      The consumer group ID must be unique among all your Kafka event sources. After creating a Kafka event source mapping with the consumer group ID specified, you cannot update this value. The value must have a lenght between 1 and 200 and full the pattern '[a-zA-Z0-9-/:_+=.@-]'.

      Default: - none

      Parameters:
      consumerGroupId - The identifier for the Kafka consumer group to join. This parameter is required.
      Returns:
      this
      See Also:
    • filterEncryption

      @Stability(Stable) public ManagedKafkaEventSource.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 ManagedKafkaEventSource.Builder filters(List<? extends Map<String,? extends Object>> filters)
      Add filter criteria to Event Source.

      Default: - none

      Parameters:
      filters - Add filter criteria to Event Source. This parameter is required.
      Returns:
      this
      See Also:
    • onFailure

      @Stability(Stable) public ManagedKafkaEventSource.Builder onFailure(IEventSourceDlq onFailure)
      Add an on Failure Destination for this Kafka event.

      SNS/SQS/S3 are supported

      Default: - discarded records are ignored

      Parameters:
      onFailure - Add an on Failure Destination for this Kafka event. This parameter is required.
      Returns:
      this
    • secret

      @Stability(Stable) public ManagedKafkaEventSource.Builder secret(ISecret secret)
      The secret with the Kafka credentials, see https://docs.aws.amazon.com/msk/latest/developerguide/msk-password.html for details This field is required if your Kafka brokers are accessed over the Internet.

      Default: none

      Parameters:
      secret - The secret with the Kafka credentials, see https://docs.aws.amazon.com/msk/latest/developerguide/msk-password.html for details This field is required if your Kafka brokers are accessed over the Internet. This parameter is required.
      Returns:
      this
    • clusterArn

      @Stability(Stable) public ManagedKafkaEventSource.Builder clusterArn(String clusterArn)
      An MSK cluster construct.

      Parameters:
      clusterArn - An MSK cluster construct. This parameter is required.
      Returns:
      this
    • build

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