Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement Chalice multi-dispatch #1134
Conversation
|
my two cents, i prefer having the functions separated as it makes debugging/operations in the case of monitoring, finding errors in logs, etc significantly clearer. ie. if this is useful for some contexts/users it would be good to clarify the use case/benefit, and additionally make it an optional/explicit opt in. |
|
@kapilt, the beauty of this is that nothing forces you to use the same entry point for multiple event types. But if you want to share an entry point across event types, with this you can. Actually, by default the CloudFormation code emitted will still produce dedicated entry points, even though |
|
that sounds interesting. do you have an example of what it looks like to use this feature? ie what changes for an app to designate that single function/designation endpoint. i see user_handler being weaved in unconditionally through the registrations, its a little unclear what populates that.. it looks sounds like the intent is is to allow something like this to work? @app.sqs('/')
@app.schedule('rate (1 day)')
def do_work(event, context):
return {'hello': 'world'} |
|
I think I didn't explain this very well. :) Generally, when I say "entry point" I'm referring to what's specified in the AWS Lambda Function as the "handler". In the HTTP / API Gateway case, that's Now what my proposed change does is that you can have a single instance of the Lambda function configured with a handler of For code in the Does this make sense? |
Chalice can now handle all supported event types (CloudWatch, S3, SNS, SQS) through the single `app.app` (AKA `Chalice.__call__`) entry point. This allows us to handle both HTTP and other events with a single Lambda instance.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

jmehnle commentedMay 28, 2019
Chalice can now handle all supported event types (CloudWatch, S3, SNS, SQS) through the single
app.app(AKAChalice.__call__) entry point.This allows us to handle both HTTP and other events with a single Lambda instance.
Would you be willing to adopt this? If so, I'm willing to bring this PR into an acceptable shape, including unit tests and any documentation that you deem necessary.