quantummaid / httpmaid

HttpMaid directly publishes your business logic as an HTTP endpoint.
https://quantummaid.de
Apache License 2.0
10 stars 0 forks source link

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

Open lestephane opened 4 years ago

lestephane commented 4 years ago

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

lestephane commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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.