Skip to content
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

Add handler support for SNS, dynamodb and kinesis events #290

Merged
merged 1 commit into from
Aug 31, 2016

Conversation

parroyo
Copy link
Contributor

@parroyo parroyo commented Aug 29, 2016

Related to #225

I added a fix to process SNS, kinesis and DynamoDB AWS events. Sadly, I couldn't find a generic way to handle all the events like the s3 events.

The function to call in the handler is not send in other events but s3 ones. So I've added a AWS_EVENT_MAPPING property to zappa_settings.py in order to resolve the function to invoke based on the event source arn.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.1%) to 81.564% when pulling 27b7526 on parroyo:master into dbffbee on Miserlou:master.

@Miserlou
Copy link
Owner

@parroyo - sorry for not commenting on this earlier!

Mapping events to functions is what I was afraid of, but you've solved it with with AWS_EVENT_MAPPING, which looks to be an inspired solution. Thank you for including the tests as well!

@Miserlou Miserlou merged commit 9207001 into Miserlou:master Aug 31, 2016
@Miserlou
Copy link
Owner

Ah. I think there could be a problem with this, however.

This seems like it only coverts event sources, and not event types. For example, if I want to have a different function execute in response to SQS pushes and SQS pops on the same queue, this setting won't work. AWS_EVENT_MAPPING must need to be a dict of dicts?

@parroyo
Copy link
Contributor Author

parroyo commented Aug 31, 2016

@Miserlou As far as I know, the only lambda subscription that supports different event types is the S3 one. And for S3 events, we are getting the function name to invoke based on the configurationId property, so you can have different functions to handle different events from the same S3 source

        if 's3' in record:
             return record['s3']['configurationId']

About the SQS events, they cannot invoke lambda functions. You can only subscribe to a SNS topic instead.

@Miserlou
Copy link
Owner

Ah, I see. Okay, gotcha. I'm going to think about this some more, but I think that we're all set then.

I really appreciate you taking the initiative on this issue, truly excellent work!

kalkehcoisa pushed a commit to kalkehcoisa/Zappa that referenced this pull request Jan 30, 2024
Add handler support for SNS, dynamodb and kinesis events
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants