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

[BUG] AwsLambdaEndpoint should implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> #85

Open
lestephane opened this issue Jun 6, 2020 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@lestephane
Copy link

Describe the bug
AwsLambdaEndpoint's main processing method is

public APIGatewayProxyResponseEvent delegate(
    final APIGatewayProxyRequestEvent event,
    final Context context) {

It should instead be called handleRequest() and the AwsLambdaEndpoint java class should be marked as implements RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent>, so that

  • anAwsLambdaEndpoint() can return RequestHandler<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent>, so that
  • the user only has to import the RequestHandler interface from the AWS SDK. This is important since QuantumMaid promises not to force devs to import quantummaid classes and interfaces.
@lestephane lestephane added the bug Something isn't working label Jun 6, 2020
@lestephane
Copy link
Author

hmm, The user has to import AwsLambdaEndpoint anyway, so maybe the import argument is not as relevant, but the implements clause must be there, and delegate() as a method name is dubious. The fact that the instance is used as a delegate should not be reflected in the method name.

@marcoeggersmann
Copy link

I agree that the method name is dubious. We might be able to create an AWS Lambda endpoint without having a dependency on the AWS SDK at all. In this case, the implements will not be possible. Otherwise, we will add it.

@lestephane
Copy link
Author

Maybe use RequestHandler<Map<String,String>, String> so we can add ApiGatewayV2 (aka httpapi) without changing callers later.

Is the use of RequestStreamHandler made impossible by the use of MessageMaid? It could be another way to have a single interface covering all cases (restapi, httpapi)

@marcoeggersmann
Copy link

Map<String, Object is the current work in progress, which will theoretically be able to handle all types of lambda events. I only looked at RequestStreamHandler briefly. As far as I understand, it provides the same information as a Map<String, Object> handler would, just as a stream. It could offer performance improvements, but will not add more flexibility. MapMaid is currently not used for parsing lambda events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants