-
Notifications
You must be signed in to change notification settings - Fork 105
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
Document what to do with AWS "Handler" name. #57
Comments
I think the handler name is important as the code could contain many lambda function in the same binary even if it executes the only one selected. |
Hi @Andrea-Scuderi , you can easily achieve the use case you mention with the tools at hand right now: import AWSLambdaRuntime
switch Lambda.env("_HANDLER") {
case "foo":
Lambda.run(FooHandler())
case "bar":
Lambda.run(BarHandler())
default:
preconditionError("Unexpected handler name: \(Lambda.env("_HANDLER") ?? "none given")")
} In my humble opinion it doesn't make much sense though to include two or more
Instead I would suggest you create an executable target for each lambda. This way you will have better performance and one less String attached. 😉 In other languages like golang the |
@fabianfett Agreed, your considerations are right, but there are cases in which this could make sense:
|
Here the example with multiple handlers #125 |
We currently don't respect the chosen handler and rely on the executable being named bootstrap. We should at least document that we don't care about the given handler name, or that developers might want to use it in their lambda startup method to decide which handler they wanna attach to the runtime.
The text was updated successfully, but these errors were encountered: