Class AfterExecutionEvent

java.lang.Object
io.micronaut.function.aws.event.AfterExecutionEvent

public final class AfterExecutionEvent extends Object
This event is published after the execution of FunctionExecutor.execute(Object) and StreamFunctionExecutor.execute(java.io.InputStream, java.io.OutputStream) methods to allow performing actions before the Lambda function run is finished and the JVM is hibernated.

This event must be processed synchronously to guarantee it has been processed before the Lambda funciton is hibernated.

Since:
3.9.0
Author:
Vladimir Orany
  • Method Details

    • success

      public static AfterExecutionEvent success(@Nullable @Nullable com.amazonaws.services.lambda.runtime.Context context, @Nullable @Nullable Object output)
      Creates a new AfterExecutionEvent with an optional result of the execution.
      Parameters:
      context - AWS Lambda context
      output - an optional result of the exectuion
      Returns:
      a new AfterExecutionEvent with an optional result of the execution
    • failure

      public static AfterExecutionEvent failure(@Nullable @Nullable com.amazonaws.services.lambda.runtime.Context context, Throwable exception)
      Creates a new AfterExecutionEvent with an exception been thrown.
      Parameters:
      context - AWS Lambda context
      exception - the exception which has been thrown during the execution
      Returns:
      a new AfterExecutionEvent with an exception been thrown.
    • isSuccess

      public boolean isSuccess()
      Returns:
      true if there were no exception thrown
    • getOutput

      @Nullable public @Nullable Object getOutput()
      Returns:
      the optional result of the execution
    • getException

      @Nullable public @Nullable Throwable getException()
      Returns:
      the optional exception which has been thrown
    • getContext

      @Nullable public @Nullable com.amazonaws.services.lambda.runtime.Context getContext()
      Returns:
      the optional Lambda context