Package io.micronaut.function.aws.event
Class AfterExecutionEvent
java.lang.Object
io.micronaut.function.aws.event.AfterExecutionEvent
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 Summary
Modifier and TypeMethodDescriptionstatic AfterExecutionEvent
Creates a newAfterExecutionEvent
with an exception been thrown.@Nullable com.amazonaws.services.lambda.runtime.Context
@Nullable Throwable
@Nullable Object
boolean
static AfterExecutionEvent
Creates a newAfterExecutionEvent
with an optional result of the execution.
-
Method Details
-
success
public static AfterExecutionEvent success(@Nullable @Nullable com.amazonaws.services.lambda.runtime.Context context, @Nullable @Nullable Object output) Creates a newAfterExecutionEvent
with an optional result of the execution.- Parameters:
context
- AWS Lambda contextoutput
- 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 newAfterExecutionEvent
with an exception been thrown.- Parameters:
context
- AWS Lambda contextexception
- 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
- Returns:
- the optional result of the execution
-
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
-