-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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: Add SQS option to SNS event #1065
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #1065 +/- ##
===========================================
+ Coverage 94.72% 94.75% +0.03%
===========================================
Files 70 71 +1
Lines 3430 3472 +42
Branches 675 678 +3
===========================================
+ Hits 3249 3290 +41
Misses 93 93
- Partials 88 89 +1
Continue to review full report at Codecov.
|
return SQSQueue(self.logical_id + 'Queue') | ||
|
||
def _inject_sqs_event_source_mapping(self, function, role, queue_arn): | ||
event_source = SQS(self.logical_id + 'EventSourceMapping') |
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.
Is this correct way to create LambdaEventSourceMapping
resource?
Should I add LambdaEventSourceMapping
and put linked_policy to IAM Role directory instead use SQS object?
I think the logic to create LambdaEventSourceMapping and linked_policy is completely same as SQS pull event. So I use SQS object.
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.
It looks like that is the correct way to add this event source mapping 👍
versions/2016-10-31.md
Outdated
@@ -429,6 +429,7 @@ Property Name | Type | Description | |||
Topic | `string` | **Required.** Topic ARN. | |||
Region | `string` | Region. | |||
FilterPolicy | [Amazon SNS filter policy](https://docs.aws.amazon.com/sns/latest/dg/message-filtering.html) | Policy assigned to the topic subscription in order to receive only a subset of the messages. | |||
SqsSubscription | `boolean` | Indicates whether SQS option is enabled. |
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'm sorry but I'm non-native english speaker so could anyone provide appropriate description for SqsSubscription
?
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.
Sure. I would say:
SqsSubscription | `boolean` | Set to `true` to enable batching SNS topic notifications in an SQS queue.
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.
Thank you for giving me a hand!
I made suggested change in e7e2dd8.
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.
This looks like a great feature, thank you for contributing this! Just a few comments->
Could you also update https://github.com/awslabs/serverless-application-model/blob/develop/docs/internals/generated_resources.rst#sns to explain that a new SQS resource is created if SqsSubscription: true
is used?
versions/2016-10-31.md
Outdated
@@ -429,6 +429,7 @@ Property Name | Type | Description | |||
Topic | `string` | **Required.** Topic ARN. | |||
Region | `string` | Region. | |||
FilterPolicy | [Amazon SNS filter policy](https://docs.aws.amazon.com/sns/latest/dg/message-filtering.html) | Policy assigned to the topic subscription in order to receive only a subset of the messages. | |||
SqsSubscription | `boolean` | Indicates whether SQS option is enabled. |
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.
Sure. I would say:
SqsSubscription | `boolean` | Set to `true` to enable batching SNS topic notifications in an SQS queue.
return SQSQueue(self.logical_id + 'Queue') | ||
|
||
def _inject_sqs_event_source_mapping(self, function, role, queue_arn): | ||
event_source = SQS(self.logical_id + 'EventSourceMapping') |
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.
It looks like that is the correct way to add this event source mapping 👍
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 have addressed your pull request comments.
Ready for review again.
19f3525
to
2ed258f
Compare
0acd583
to
f36fd1a
Compare
Added an example of how to use new SqsSubscription option. |
Issue #, if available:
#854
This pull request will resolve #854 partially.
I implemented simple boolean
SqsSubscription
option to SNSEvent at first.Description of changes:
Added SQS option(
SqsSubscription
) to SNS event.Description of how you validated changes:
Checklist:
make pr
passesexamples/2016-10-31
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.