-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(lambda): Support S3 as onFailure destinations on MSK and SelfManagedKafka events #28010
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Summary
This PR will include following features
Backgrounds
Lambda Event Source Mapping (ESM) processes events from event sources in a sequence manner. However, a potential issue with this approach is that if a record is deemed a “poison pill”, it will be retried indefinitely until it is processed successfully or until the record expires. This can cause delays in processing others records in the queue. Additionally, for events that exceed the Lambda payload limit of 6 MB, they might be dropped as they cannot be processed.
Today, Lambda supports configuring an OnSuccess destination and OnFailure destination for asynchronous invocations. For stream-based event sources, such as Kinesis, and DynamoDB streams, Lambda supports configuring an OnFailure destination. Regarding SQS, SQS poller doesn’t support OnFailure destination, but SQS support Dead Letter Queue (DLQ) natively.
For CDK, Some event source mappings (events) can have onFailure destination through a DestinationConfig. Right now that supports only DynamoDB and Kinesis event sources and only SQS and SNS destinations.
Solution
s3onFailureDestination
destination ins3-ofd.ts
fileonFailure
toKafkaEventSourceProps
that customer can uses3onFailureDestination
to pass in.enrichMappingOptions
for every event type againstEventSourceMappingOptions.supportS3OFD
to check if they support S3 as onFailure.User Experience
sample synth output
To discuss
Change parent class name
The parent class of
s3ofd
is calledIEventSourceDlq
.DLQ
stands for Dead Letter Queue, Which is very specific for SQS, we might want to work out a new naming for S3Option 1:
Rename the
IEventSourceDlq
toIEventSourceOfd
(Ofd: OnFailureDestinaion)And createIEventSourceDlq
again to extends from it for keeping backwards compatibility.For S3, Create a new class
IEventSourceS3ofd
. also extend from the parent class and will be implemented by our new S3 Destination class.Option 2:
Don’t create new parent classes, the new S3 Destination class just extend the original
IEventSourceDlq
Class. Like what is shown in the current code.Where to add checking for s3 on failure desintation support
Currently in the commit, I was checking for s3ofd support in
enrichMappingOptions
Which will be called by all event source classes. Does this design make sense, or should we create a new dedicated function for chcecking?Questions:
Closes #.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license