Class QAbstractLambdaHandler
java.lang.Object
com.kingsrook.qqq.lambda.QAbstractLambdaHandler
- All Implemented Interfaces:
com.amazonaws.services.lambda.runtime.RequestStreamHandler
- Direct Known Subclasses:
QBaseCustomLambdaHandler,QStandardLambdaHandler
public abstract class QAbstractLambdaHandler
extends Object
implements com.amazonaws.services.lambda.runtime.RequestStreamHandler
Abstract base class for any and all QQQ lambda handlers.
This class provides the method `handleRequest(InputStream, OutputStream, Context)`,
which is what gets invoked by AWS Lambda. In there, we parse the data from
the inputStream to build a QLambdaRequest - which is then passed to:
`handleRequest(QLambdaRequest)` - which would be meant for implementing in a
subclass.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected com.amazonaws.services.lambda.runtime.Contextstatic final QLambdaResponsestatic final QLambdaResponse -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected QLambdaResponsehandleJsonRequest(QLambdaRequest request, org.json.JSONObject bodyJsonObject) Meant to be overridden by subclasses, to provide functionality, if needed.protected abstract QLambdaResponsehandleRequest(QLambdaRequest request) voidhandleRequest(InputStream inputStream, OutputStream outputStream, com.amazonaws.services.lambda.runtime.Context context) Entrypoint from AWS Lambda.protected voidWrite to the cloudwatch logs.protected voidWrite to the cloudwatch logs.protected voidprotected voidwriteResponse(OutputStream outputStream, String requestId, QLambdaResponse response)
-
Field Details
-
context
protected com.amazonaws.services.lambda.runtime.Context context -
GENERIC_SERVER_ERROR
-
OK
-
-
Constructor Details
-
QAbstractLambdaHandler
public QAbstractLambdaHandler()Constructor
-
-
Method Details
-
handleRequest
public void handleRequest(InputStream inputStream, OutputStream outputStream, com.amazonaws.services.lambda.runtime.Context context) throws IOException Entrypoint from AWS Lambda.- Specified by:
handleRequestin interfacecom.amazonaws.services.lambda.runtime.RequestStreamHandler- Throws:
IOException
-
handleRequest
- Throws:
QException
-
handleJsonRequest
protected QLambdaResponse handleJsonRequest(QLambdaRequest request, org.json.JSONObject bodyJsonObject) throws QException Meant to be overridden by subclasses, to provide functionality, if needed.- Throws:
QException
-
log
Write to the cloudwatch logs. -
log
-
log
-
writeResponse
protected void writeResponse(OutputStream outputStream, String requestId, QLambdaResponse response) throws IOException - Throws:
IOException
-