Class StepContextImpl
java.lang.Object
software.amazon.lambda.durable.context.BaseContextImpl
software.amazon.lambda.durable.context.StepContextImpl
- All Implemented Interfaces:
AutoCloseable,BaseContext,StepContext
Context available inside a step operation's user function.
Provides access to the current retry attempt number and a logger that includes execution metadata. Extends
BaseContext for thread lifecycle management.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedStepContextImpl(ExecutionManager executionManager, DurableConfig durableConfig, com.amazonaws.services.lambda.runtime.Context lambdaContext, String stepOperationId, String stepOperationName, int attempt) Creates a new StepContext instance for use in step operations. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the logger for this context.intReturns the current retry attempt number (0-based).Gets a logger with additional information of the current execution context.Methods inherited from class software.amazon.lambda.durable.context.BaseContextImpl
getContextId, getContextName, getDurableConfig, getExecutionArn, getExecutionManager, getLambdaContext, isReplaying, setExecutionModeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.lambda.durable.context.BaseContext
getContextId, getContextName, getDurableConfig, getExecutionArn, getLambdaContext, isReplaying
-
Constructor Details
-
StepContextImpl
protected StepContextImpl(ExecutionManager executionManager, DurableConfig durableConfig, com.amazonaws.services.lambda.runtime.Context lambdaContext, String stepOperationId, String stepOperationName, int attempt) Creates a new StepContext instance for use in step operations.- Parameters:
executionManager- Manages durable execution state and operationsdurableConfig- Configuration for durable execution behaviorlambdaContext- AWS Lambda runtime contextstepOperationId- Unique identifier for this context instance that equals to step operation idstepOperationName- the name of the step operationattempt- the current retry attempt number (0-based)
-
-
Method Details
-
getAttempt
public int getAttempt()Returns the current retry attempt number (0-based).- Specified by:
getAttemptin interfaceStepContext
-
getLogger
Description copied from interface:BaseContextGets a logger with additional information of the current execution context.- Specified by:
getLoggerin interfaceBaseContext- Returns:
- a DurableLogger instance
-
close
public void close()Closes the logger for this context.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceBaseContext
-