-
Notifications
You must be signed in to change notification settings - Fork 104
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 new abstraction for simple Lambda that does not need explicit initialization #259
Conversation
…ialization motivation: make simple things simple changes: * add new abstraction names SimpleLambdaHandler that has a default initializer * add test
we could / should consider doing this on |
We can drop |
@stevapple |
Is there any reason they cannot use async/await for asynchronous startup, and use throw in place of manual termination? I think that's the "simple" way and should work for most people. |
termination is for resource cleanup when shutting down, there needs to be an entry point to that. also all NIO based clients (eg db client based on NIO) need access the the |
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.
While I like the idea of making Lambda easier to use, I wonder if we actually achieve this goal through this change. Until now, IMO, it was clear which Handler protocol we recommend: LambdaHandler. Now the story is becoming harder.
Let's look at the pros and cons of this change:
Pro:
- We can remove 1-3 lines for very simple LambdaHandlers.
- Users don't need to specify an explicit init
Con:
- We need to explain to users the difference between
SimpleLambdaHandler
andLambdaHandler
even in the Simple case. We need explain to users, that they shall useSimpleLambdaHandler
if they don't have any resources that they want to share between invocations. - The way from a very simple lambda to an actual lambda (I think every real lambda, will use some shared network resources) is becoming harder. We need to remind developers, that they need to change the
Handler
protocol and now need to implement a new init method. There is no compiler warning to point them into the right direction.
In my opinion the cons outweigh the pros. Is there something that I have overseen?
superseded by #273 |
motivation: make simple things simple
changes: