public final class MicronautLambdaContainerHandler extends AbstractLambdaContainerHandler<com.amazonaws.serverless.proxy.model.AwsProxyRequest,com.amazonaws.serverless.proxy.model.AwsProxyResponse,MicronautAwsProxyRequest<?>,MicronautAwsProxyResponse<?>> implements io.micronaut.context.ApplicationContextProvider, java.io.Closeable, java.lang.AutoCloseable
lambdaContext, SERVER_INFO
Modifier and Type | Method and Description |
---|---|
void |
close() |
io.micronaut.context.ApplicationContext |
getApplicationContext() |
static MicronautLambdaContainerHandler |
getAwsProxyHandler()
Gets a new
MicronautLambdaContainerHandler should be called exactly once. |
static MicronautLambdaContainerHandler |
getAwsProxyHandler(io.micronaut.context.ApplicationContextBuilder builder)
Gets a new
MicronautLambdaContainerHandler should be called exactly once. |
protected MicronautAwsProxyResponse<?> |
getContainerResponse(MicronautAwsProxyRequest<?> request,
java.util.concurrent.CountDownLatch latch)
Get the container response.
|
protected void |
handleRequest(MicronautAwsProxyRequest<?> containerRequest,
MicronautAwsProxyResponse<?> containerResponse,
com.amazonaws.services.lambda.runtime.Context lambdaContext)
Handle the request.
|
void |
initialize()
Initialize the container.
|
protected com.fasterxml.jackson.databind.ObjectMapper |
objectMapper()
The object mapper.
|
protected com.fasterxml.jackson.databind.ObjectReader |
readerFor(java.lang.Class<com.amazonaws.serverless.proxy.model.AwsProxyRequest> requestClass)
Gets a reader for the given request class.
|
protected com.fasterxml.jackson.databind.ObjectWriter |
writerFor(java.lang.Class<com.amazonaws.serverless.proxy.model.AwsProxyResponse> responseClass)
Gets a writer for the given response class.
|
getContainerConfig, proxy, proxyStream, setLogFormatter, stripBasePath
public static MicronautLambdaContainerHandler getAwsProxyHandler() throws com.amazonaws.serverless.exceptions.ContainerInitializationException
MicronautLambdaContainerHandler
should be called exactly once.MicronautLambdaContainerHandler
com.amazonaws.serverless.exceptions.ContainerInitializationException
- if the container couldn't be startedpublic static MicronautLambdaContainerHandler getAwsProxyHandler(io.micronaut.context.ApplicationContextBuilder builder) throws com.amazonaws.serverless.exceptions.ContainerInitializationException
MicronautLambdaContainerHandler
should be called exactly once.builder
- The builder to customize the context creationMicronautLambdaContainerHandler
com.amazonaws.serverless.exceptions.ContainerInitializationException
- if the container couldn't be startedpublic io.micronaut.context.ApplicationContext getApplicationContext()
getApplicationContext
in interface io.micronaut.context.ApplicationContextProvider
protected com.fasterxml.jackson.databind.ObjectMapper objectMapper()
AbstractLambdaContainerHandler
objectMapper
in class AbstractLambdaContainerHandler<com.amazonaws.serverless.proxy.model.AwsProxyRequest,com.amazonaws.serverless.proxy.model.AwsProxyResponse,MicronautAwsProxyRequest<?>,MicronautAwsProxyResponse<?>>
protected com.fasterxml.jackson.databind.ObjectWriter writerFor(java.lang.Class<com.amazonaws.serverless.proxy.model.AwsProxyResponse> responseClass)
AbstractLambdaContainerHandler
writerFor
in class AbstractLambdaContainerHandler<com.amazonaws.serverless.proxy.model.AwsProxyRequest,com.amazonaws.serverless.proxy.model.AwsProxyResponse,MicronautAwsProxyRequest<?>,MicronautAwsProxyResponse<?>>
responseClass
- The response classprotected com.fasterxml.jackson.databind.ObjectReader readerFor(java.lang.Class<com.amazonaws.serverless.proxy.model.AwsProxyRequest> requestClass)
AbstractLambdaContainerHandler
readerFor
in class AbstractLambdaContainerHandler<com.amazonaws.serverless.proxy.model.AwsProxyRequest,com.amazonaws.serverless.proxy.model.AwsProxyResponse,MicronautAwsProxyRequest<?>,MicronautAwsProxyResponse<?>>
requestClass
- The request classprotected MicronautAwsProxyResponse<?> getContainerResponse(MicronautAwsProxyRequest<?> request, java.util.concurrent.CountDownLatch latch)
AbstractLambdaContainerHandler
getContainerResponse
in class AbstractLambdaContainerHandler<com.amazonaws.serverless.proxy.model.AwsProxyRequest,com.amazonaws.serverless.proxy.model.AwsProxyResponse,MicronautAwsProxyRequest<?>,MicronautAwsProxyResponse<?>>
request
- The requestlatch
- The count down latchpublic void initialize() throws com.amazonaws.serverless.exceptions.ContainerInitializationException
AbstractLambdaContainerHandler
initialize
in class AbstractLambdaContainerHandler<com.amazonaws.serverless.proxy.model.AwsProxyRequest,com.amazonaws.serverless.proxy.model.AwsProxyResponse,MicronautAwsProxyRequest<?>,MicronautAwsProxyResponse<?>>
com.amazonaws.serverless.exceptions.ContainerInitializationException
- when an error occursprotected void handleRequest(MicronautAwsProxyRequest<?> containerRequest, MicronautAwsProxyResponse<?> containerResponse, com.amazonaws.services.lambda.runtime.Context lambdaContext)
AbstractLambdaContainerHandler
handleRequest
in class AbstractLambdaContainerHandler<com.amazonaws.serverless.proxy.model.AwsProxyRequest,com.amazonaws.serverless.proxy.model.AwsProxyResponse,MicronautAwsProxyRequest<?>,MicronautAwsProxyResponse<?>>
containerRequest
- The container requestcontainerResponse
- The responselambdaContext
- The lambda contextpublic void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable