interface KafkaEventSourceProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.Lambda.EventSources.KafkaEventSourceProps |
Java | software.amazon.awscdk.services.lambda.eventsources.KafkaEventSourceProps |
Python | aws_cdk.aws_lambda_event_sources.KafkaEventSourceProps |
TypeScript (source) | @aws-cdk/aws-lambda-event-sources » KafkaEventSourceProps |
Properties for a Kafka event source.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as lambda from '@aws-cdk/aws-lambda';
import * as lambda_event_sources from '@aws-cdk/aws-lambda-event-sources';
import * as secretsmanager from '@aws-cdk/aws-secretsmanager';
import * as cdk from '@aws-cdk/core';
declare const secret: secretsmanager.Secret;
const kafkaEventSourceProps: lambda_event_sources.KafkaEventSourceProps = {
startingPosition: lambda.StartingPosition.TRIM_HORIZON,
topic: 'topic',
// the properties below are optional
batchSize: 123,
enabled: false,
maxBatchingWindow: cdk.Duration.minutes(30),
secret: secret,
};
Properties
Name | Type | Description |
---|---|---|
starting | Starting | Where to begin consuming the stream. |
topic | string | The Kafka topic to subscribe to. |
batch | number | The largest number of records that AWS Lambda will retrieve from your event source at the time of invoking your function. |
enabled? | boolean | If the stream event source mapping should be enabled. |
max | Duration | The maximum amount of time to gather records before invoking the function. |
secret? | ISecret | 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. |
startingPosition
Type:
Starting
Where to begin consuming the stream.
topic
Type:
string
The Kafka topic to subscribe to.
batchSize?
Type:
number
(optional, default: 100)
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}
enabled?
Type:
boolean
(optional, default: true)
If the stream event source mapping should be enabled.
maxBatchingWindow?
Type:
Duration
(optional, default: Duration.seconds(0))
The maximum amount of time to gather records before invoking the function.
Maximum of Duration.minutes(5)
secret?
Type:
ISecret
(optional, default: none)
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.