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

Static or No-Static Handler? #109

Closed
feinstein opened this issue Jan 26, 2018 · 3 comments
Closed

Static or No-Static Handler? #109

feinstein opened this issue Jan 26, 2018 · 3 comments
Assignees
Milestone

Comments

@feinstein
Copy link
Contributor

The documentation here says:

The handler object should be declared as a class property and be static. By doing this, Lambda will re-use the instance for subsequent requests.

But the code sample just below the text doesn't have the static modifier. Why? Should handler be static or not?

@sapessi
Copy link
Collaborator

sapessi commented Jan 26, 2018

I'll clean up the documentation. The point I need to make is that the handler should be declared as member variables in your handler class. The Lambda runtime initializes your handler as a singleton and keeps re-using the same object to handle subsequent events - given this behavior, having the handler as a member variables allows us to re-use the same handler across multiple events.

@feinstein
Copy link
Contributor Author

That's good to be on the documentations as well.

sapessi added a commit that referenced this issue Feb 11, 2018
…and moved them all to the new streamProxy method (#118).
@sapessi
Copy link
Collaborator

sapessi commented Feb 11, 2018

Updated samples and doc is ready for next release. resolving.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants