[aws-lambda] Add "Topics" property to EventSourceMappingOptions
See original GitHub issueLambda recently added support for MSK as an event source (https://aws.amazon.com/about-aws/whats-new/2020/08/aws-lambda-now-supports-amazon-managed-streaming-for-apache-kafka-as-an-event-source/), and there’s now a “Topics” property on the CloudFormation resource definition (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-topics).
Use Case
Using Lambda simplifies reading data from Apache Kafka, as other options usually require customers to worry about infrastructure management.
Proposed Solution
Include topics
as an optional parameter of EventSourceMappingOptions
interface:
export interface EventSourceMappingOptions {
/**
* existing properties
*/
/**
* The name of the Kafka topic.
*
* Valid range:
* * Maximum value of 1
*/
readonly topics?: string[];
}
It’d then be used as:
lambdaFn.addEventSourceMapping('MSKTrigger', {
eventSourceArn: 'arn:aws:kafka:us-east-1:123456789012:cluster/kafka-cluster/random-id',
startingPosition: lambda.StartingPosition.LATEST,
topics: ['my-topic']
});
Other
In the future, there could even be a MSKEventSource
in the aws-lambda-event-sources
package, but just adding the topics
property should allow customers to get started.
- 👋 I may be able to implement this feature request
- ⚠️ This feature might incur a breaking change
This is a 🚀 Feature Request
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (7 by maintainers)
Top GitHub Comments
Definitely not. Feel free to post one.
@nija-at PR was created: https://github.com/aws/aws-cdk/pull/10445