Class SelfManagedKafkaEventSource

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.lambda.eventsources.StreamEventSource
software.amazon.awscdk.services.lambda.eventsources.SelfManagedKafkaEventSource
All Implemented Interfaces:
IEventSource, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-22T02:24:04.022Z") @Stability(Stable) public class SelfManagedKafkaEventSource extends StreamEventSource
Use a self hosted Kafka installation as a streaming source for AWS Lambda.

Example:

 import software.amazon.awscdk.services.secretsmanager.Secret;
 import software.amazon.awscdk.services.lambda.eventsources.SelfManagedKafkaEventSource;
 // The secret that allows access to your self hosted Kafka cluster
 Secret secret;
 Function myFunction;
 // The list of Kafka brokers
 String[] bootstrapServers = List.of("kafka-broker:9092");
 // The Kafka topic you want to subscribe to
 String topic = "some-cool-topic";
 // (Optional) The consumer group id to use when connecting to the Kafka broker. If omitted the UUID of the event source mapping will be used.
 String consumerGroupId = "my-consumer-group-id";
 myFunction.addEventSource(SelfManagedKafkaEventSource.Builder.create()
         .bootstrapServers(bootstrapServers)
         .topic(topic)
         .consumerGroupId(consumerGroupId)
         .secret(secret)
         .batchSize(100) // default
         .startingPosition(StartingPosition.TRIM_HORIZON)
         .build());
 
  • Constructor Details

    • SelfManagedKafkaEventSource

      protected SelfManagedKafkaEventSource(software.amazon.jsii.JsiiObjectRef objRef)
    • SelfManagedKafkaEventSource

      protected SelfManagedKafkaEventSource(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • SelfManagedKafkaEventSource

      @Stability(Stable) public SelfManagedKafkaEventSource(@NotNull SelfManagedKafkaEventSourceProps props)
      Parameters:
      props - This parameter is required.
  • Method Details

    • bind

      @Stability(Stable) public void bind(@NotNull IFunction target)
      Called by lambda.addEventSource to allow the event source to bind to this function.

      Specified by:
      bind in interface IEventSource
      Specified by:
      bind in class StreamEventSource
      Parameters:
      target - This parameter is required.