-
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-event-sources): add kafka consumerGroupId support #21791
feat(lambda-event-sources): add kafka consumerGroupId support #21791
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
@mrgrain You were reviewing a kafka related PR in the past, so maybe you are interested this time as well? 😃 |
* | ||
* @default - none | ||
*/ | ||
readonly consumerGroupId?: EventSourceMappingOptions['kafkaConsumerGroupId']; |
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.
Ultimately this resolves to a string so I'm not sure what the benefit of assigning the type this way.
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.
Yes it is just a string, but my intention was to give someone that is looking at the code some guidance that the consumerGroupId is the same as the kafkaConsumerGroupId. And then it is easier to follow the path of the property to further documentation and usage. In this case the consumerGroupId is just a renaming of the property kafkaConsumerGroupId to have a shorter property name because we are aöready in the context of kafka properties.
But I get that this way of defining properties is a new style and therefore not optimal.
Please let me know if I should change it to or the property path reasoning has more value than just putting string here.
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.
I appreciate trying to give the extra context but I'm not sure that writing it this way will play nice with JSII when translating it into the other languages we use. That, and consistency in style is something I tend to think is pretty important for those who come after and try to understand the code to make changes again. I would use the docstring to provide this context if you don't think it's clear enough.
I do, however, like that you did shorten the name for the reason you listed.
let amazonManagedKafkaEventSourceConfig : CfnEventSourceMapping['amazonManagedKafkaEventSourceConfig']; | ||
let selfManagedKafkaEventSourceConfig: CfnEventSourceMapping['selfManagedKafkaEventSourceConfig']; |
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.
Let's figure out which one of these it should be mapped to and just set it there instead of providing both props.
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.
I split it into two if statements to have less branching. Additionally i moved the validation to private function to have a cleaner view on the logic.
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.
I like this much better. Thanks!
Pull request has been modified.
0e1a308
to
01b4f41
Compare
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.
Please see my comments inline. This is almost perfect. Thanks for bearing with me on all the stylistic changes requested and my constant request of MOAR TESTS.
* | ||
* @default - none | ||
*/ | ||
readonly consumerGroupId?: EventSourceMappingOptions['kafkaConsumerGroupId']; |
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.
I appreciate trying to give the extra context but I'm not sure that writing it this way will play nice with JSII when translating it into the other languages we use. That, and consistency in style is something I tend to think is pretty important for those who come after and try to understand the code to make changes again. I would use the docstring to provide this context if you don't think it's clear enough.
I do, however, like that you did shorten the name for the reason you listed.
let amazonManagedKafkaEventSourceConfig : CfnEventSourceMapping['amazonManagedKafkaEventSourceConfig']; | ||
let selfManagedKafkaEventSourceConfig: CfnEventSourceMapping['selfManagedKafkaEventSourceConfig']; |
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.
I like this much better. Thanks!
3393880
to
a6b01a1
Compare
Pull request has been modified.
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). |
This PR adds the capability to specify the consumerGroupId in the event-source-mapping when connection to Kafka.
Adds the feature described in issue #21734
This features allows you to specify the consumerGroupId while connecting to a Kafka cluster. This feature was recently annouced https://aws.amazon.com/blogs/compute/using-custom-consumer-group-id-support-for-the-aws-lambda-event-sources-for-msk-and-self-managed-kafka/ and wasn't part of the cdk Kafka construct before.
Things done:
consumerGroupId
for adding the consumerGroupId independant if selfManaged or awsManagedAll Submissions:
Adding new Unconventional Dependencies:
New Features
yarn integ
to deploy the infrastructure and generate the snapshot (i.e.yarn integ
without--dry-run
)?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license