Package io.micronaut.function.aws
Class MicronautRequestHandler<I,O>
java.lang.Object
io.micronaut.function.executor.AbstractExecutor<C>
io.micronaut.function.executor.AbstractFunctionExecutor<I,O,com.amazonaws.services.lambda.runtime.Context>
io.micronaut.function.aws.MicronautRequestHandler<I,O>
- Type Parameters:
I
- The request body typeO
- The response body type
- All Implemented Interfaces:
com.amazonaws.services.lambda.runtime.RequestHandler<I,
,O> io.micronaut.context.ApplicationContextProvider
,MicronautLambdaContext
,io.micronaut.function.executor.FunctionExecutor<I,
,O> Closeable
,AutoCloseable
public abstract class MicronautRequestHandler<I,O>
extends io.micronaut.function.executor.AbstractFunctionExecutor<I,O,com.amazonaws.services.lambda.runtime.Context>
implements com.amazonaws.services.lambda.runtime.RequestHandler<I,O>, MicronautLambdaContext
An Amazon Lambda RequestHandler
implementation for Micronaut FunctionBean
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
Fields inherited from class io.micronaut.function.executor.AbstractExecutor
applicationContext
Fields inherited from interface io.micronaut.function.aws.MicronautLambdaContext
ENVIRONMENT_LAMBDA
-
Constructor Summary
ConstructorDescriptionDefault constructor; will initialize a suitableApplicationContext
for Lambda deployment.MicronautRequestHandler
(io.micronaut.context.ApplicationContext applicationContext) Constructor used to inject a preexistingApplicationContext
.MicronautRequestHandler
(io.micronaut.context.ApplicationContextBuilder applicationContextBuilder) Constructor used to inject a preexistingApplicationContextBuilder
. -
Method Summary
Modifier and TypeMethodDescriptionprotected io.micronaut.context.ApplicationContext
buildApplicationContext
(com.amazonaws.services.lambda.runtime.Context context) protected I
convertInput
(Object input) Converts the input the required type.final O
handleRequest
(I input, com.amazonaws.services.lambda.runtime.Context context) protected @NonNull io.micronaut.context.ApplicationContextBuilder
Methods inherited from class io.micronaut.function.executor.AbstractExecutor
close, getApplicationContext, resolveFunction, resolveFunctionName, startEnvironment
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.function.executor.FunctionExecutor
execute
-
Field Details
-
ENV_X_AMZN_TRACE_ID
- See Also:
-
LAMBDA_TRACE_HEADER_PROP
- See Also:
-
-
Constructor Details
-
MicronautRequestHandler
public MicronautRequestHandler()Default constructor; will initialize a suitableApplicationContext
for Lambda deployment. -
MicronautRequestHandler
public MicronautRequestHandler(io.micronaut.context.ApplicationContext applicationContext) Constructor used to inject a preexistingApplicationContext
.- Parameters:
applicationContext
- the application context
-
MicronautRequestHandler
public MicronautRequestHandler(io.micronaut.context.ApplicationContextBuilder applicationContextBuilder) Constructor used to inject a preexistingApplicationContextBuilder
.- Parameters:
applicationContextBuilder
- the application context builder
-
-
Method Details
-
handleRequest
-
convertInput
Converts the input the required type. Subclasses can override to provide custom conversion.- Parameters:
input
- The input- Returns:
- The converted input
- Throws:
IllegalArgumentException
- If input cannot be converted
-
buildApplicationContext
protected io.micronaut.context.ApplicationContext buildApplicationContext(com.amazonaws.services.lambda.runtime.Context context) - Overrides:
buildApplicationContext
in classio.micronaut.function.executor.AbstractExecutor<com.amazonaws.services.lambda.runtime.Context>
-
newApplicationContextBuilder
@NonNull protected @NonNull io.micronaut.context.ApplicationContextBuilder newApplicationContextBuilder()- Overrides:
newApplicationContextBuilder
in classio.micronaut.function.executor.AbstractExecutor<com.amazonaws.services.lambda.runtime.Context>
-