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 type
O - 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
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     

    Fields inherited from class io.micronaut.function.executor.AbstractExecutor

    applicationContext

    Fields inherited from interface io.micronaut.function.aws.MicronautLambdaContext

    ENVIRONMENT_LAMBDA
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor; will initialize a suitable ApplicationContext for Lambda deployment.
    MicronautRequestHandler(io.micronaut.context.ApplicationContext applicationContext)
    Constructor used to inject a preexisting ApplicationContext.
    MicronautRequestHandler(io.micronaut.context.ApplicationContextBuilder applicationContextBuilder)
    Constructor used to inject a preexisting ApplicationContextBuilder.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected io.micronaut.context.ApplicationContext
    buildApplicationContext(com.amazonaws.services.lambda.runtime.Context context)
     
    protected I
    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

  • Constructor Details

    • MicronautRequestHandler

      public MicronautRequestHandler()
      Default constructor; will initialize a suitable ApplicationContext for Lambda deployment.
    • MicronautRequestHandler

      public MicronautRequestHandler(io.micronaut.context.ApplicationContext applicationContext)
      Constructor used to inject a preexisting ApplicationContext.
      Parameters:
      applicationContext - the application context
    • MicronautRequestHandler

      public MicronautRequestHandler(io.micronaut.context.ApplicationContextBuilder applicationContextBuilder)
      Constructor used to inject a preexisting ApplicationContextBuilder.
      Parameters:
      applicationContextBuilder - the application context builder
  • Method Details

    • handleRequest

      public final O handleRequest(I input, com.amazonaws.services.lambda.runtime.Context context)
      Specified by:
      handleRequest in interface com.amazonaws.services.lambda.runtime.RequestHandler<I,O>
    • convertInput

      protected I convertInput(Object input)
      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 class io.micronaut.function.executor.AbstractExecutor<com.amazonaws.services.lambda.runtime.Context>
    • newApplicationContextBuilder

      @NonNull protected @NonNull io.micronaut.context.ApplicationContextBuilder newApplicationContextBuilder()
      Overrides:
      newApplicationContextBuilder in class io.micronaut.function.executor.AbstractExecutor<com.amazonaws.services.lambda.runtime.Context>