class SelfManagedKafkaEventSource
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.Lambda.EventSources.SelfManagedKafkaEventSource |
![]() | software.amazon.awscdk.services.lambda.eventsources.SelfManagedKafkaEventSource |
![]() | aws_cdk.aws_lambda_event_sources.SelfManagedKafkaEventSource |
![]() | @aws-cdk/aws-lambda-event-sources » SelfManagedKafkaEventSource |
Implements
IEvent
Extends
Stream
Use a self hosted Kafka installation as a streaming source for AWS Lambda.
Example
import { Secret } from '@aws-cdk/aws-secretsmanager';
import { SelfManagedKafkaEventSource } from '@aws-cdk/aws-lambda-event-sources';
// The list of Kafka brokers
const bootstrapServers = ['kafka-broker:9092'];
// The Kafka topic you want to subscribe to
const topic = 'some-cool-topic';
// The secret that allows access to your self hosted Kafka cluster
declare const secret: Secret;
declare const myFunction: lambda.Function;
myFunction.addEventSource(new SelfManagedKafkaEventSource({
bootstrapServers: bootstrapServers,
topic: topic,
secret: secret,
batchSize: 100, // default
startingPosition: lambda.StartingPosition.TRIM_HORIZON,
}));
Initializer
new SelfManagedKafkaEventSource(props: SelfManagedKafkaEventSourceProps)
Parameters
Methods
Name | Description |
---|---|
bind(target) | Called by lambda.addEventSource to allow the event source to bind to this function. |
bind(target)
public bind(target: IFunction): void
Parameters
- target
IFunction
Called by lambda.addEventSource
to allow the event source to bind to this function.