Handlers in Java 

As seen previously, the handler becomes the entry point to the Lambda function. The AWS Lambda functions in Java can have two types of handlers, discussed as follows. Please note that this holds true for any language that runs on the JVM.

Handlers implementing standard interfaces, in this approach, the Lambda function handler implements the standard interfaces that are defined in the aws-lambda-core library. There are two standard interfaces, as follows:

  1. RequestHandler: The following code block shows how a Lambda function is written when implementing the RequestHandler<I,O>interface. The RequestHandler<I,O> interface has a method definition, as follows:
public O handleRequest(I name, Context context);

The code with this ...

Get Hands-On Serverless Applications with Kotlin now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.