A lambda needs a handler, which will serve as the entry point to your application. Every handler needs to implement interface RequestHandler<I, O>
where I
is the input type and O
is the output type. The input type is then passed to the handleRequest()
method and the method returns the output type.
A simple example could look like this:
package com.example.lambda;
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
public class HelloNumber implements RequestHandler<Integer, String> {
@Override
public String handleRequest(Integer input, Context context) {
return "You sent " + input;
}
}