Class CustomState
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.services.stepfunctions.State
software.amazon.awscdk.services.stepfunctions.CustomState
- All Implemented Interfaces:
- IChainable,- INextable,- software.amazon.jsii.JsiiSerializable,- software.constructs.IConstruct,- software.constructs.IDependable
@Generated(value="jsii-pacmak/1.116.0 (build 0eddcff)",
           date="2025-10-29T11:15:49.383Z")
@Stability(Stable)
public class CustomState
extends State
implements IChainable, INextable
State defined by supplying Amazon States Language (ASL) in the state machine.
 
Example:
 import software.amazon.awscdk.services.dynamodb.*;
 // create a table
 Table table = Table.Builder.create(this, "montable")
         .partitionKey(Attribute.builder()
                 .name("id")
                 .type(AttributeType.STRING)
                 .build())
         .build();
 Pass finalStatus = new Pass(this, "final step");
 // States language JSON to put an item into DynamoDB
 // snippet generated from https://docs.aws.amazon.com/step-functions/latest/dg/tutorial-code-snippet.html#tutorial-code-snippet-1
 Map<String, Object> stateJson = Map.of(
         "Type", "Task",
         "Resource", "arn:aws:states:::dynamodb:putItem",
         "Parameters", Map.of(
                 "TableName", table.getTableName(),
                 "Item", Map.of(
                         "id", Map.of(
                                 "S", "MyEntry"))),
         "ResultPath", null);
 // custom state which represents a task to insert data into DynamoDB
 CustomState custom = CustomState.Builder.create(this, "my custom task")
         .stateJson(stateJson)
         .build();
 // catch errors with addCatch
 Pass errorHandler = new Pass(this, "handle failure");
 custom.addCatch(errorHandler);
 // retry the task if something goes wrong
 custom.addRetry(RetryProps.builder()
         .errors(List.of(Errors.ALL))
         .interval(Duration.seconds(10))
         .maxAttempts(5)
         .build());
 Chain chain = Chain.start(custom).next(finalStatus);
 StateMachine sm = StateMachine.Builder.create(this, "StateMachine")
         .definitionBody(DefinitionBody.fromChainable(chain))
         .timeout(Duration.seconds(30))
         .comment("a super cool state machine")
         .build();
 // don't forget permissions. You need to assign them
 table.grantWriteData(sm);
 - 
Nested Class SummaryNested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObjectsoftware.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.stepfunctions.IChainableIChainable.Jsii$Default, IChainable.Jsii$ProxyNested classes/interfaces inherited from interface software.constructs.IConstructsoftware.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.stepfunctions.INextableINextable.Jsii$Default, INextable.Jsii$Proxy
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedCustomState(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedCustomState(software.amazon.jsii.JsiiObjectRef objRef) CustomState(software.constructs.Construct scope, String id, CustomStateProps props) 
- 
Method SummaryModifier and TypeMethodDescriptionaddCatch(IChainable handler) Add a recovery handler for this state.addCatch(IChainable handler, CatchProps props) Add a recovery handler for this state.addRetry()Add retry configuration for this state.addRetry(RetryProps props) Add retry configuration for this state.Continuable states of this Chainable.next(IChainable next) Continue normal execution with the given state.com.fasterxml.jackson.databind.node.ObjectNodeReturns the Amazon States Language object for this state.com.fasterxml.jackson.databind.node.ObjectNodetoStateJson(QueryLanguage queryLanguage) Returns the Amazon States Language object for this state.Methods inherited from class software.amazon.awscdk.services.stepfunctions.StateaddBranch, addChoice, addChoice, addItemProcessor, addItemProcessor, addIterator, addPrefix, bindToGraph, filterNextables, findReachableEndStates, findReachableEndStates, findReachableStates, findReachableStates, getArguments, getAssign, getBranches, getComment, getDefaultChoice, getId, getInputPath, getIteration, getOutputPath, getOutputs, getParameters, getProcessor, getProcessorConfig, getProcessorMode, getQueryLanguage, getResultPath, getResultSelector, getStartState, getStateId, getStateName, makeDefault, makeNext, prefixStates, renderAssign, renderAssign, renderBranches, renderChoices, renderChoices, renderInputOutput, renderItemProcessor, renderIterator, renderNextEnd, renderQueryLanguage, renderQueryLanguage, renderResultSelector, renderRetryCatch, renderRetryCatch, setDefaultChoice, setIteration, setProcessor, setProcessorConfig, setProcessorMode, validateState, whenBoundToGraphMethods inherited from class software.constructs.ConstructgetNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObjectjsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.awscdk.services.stepfunctions.IChainablegetId, getStartStateMethods inherited from interface software.amazon.jsii.JsiiSerializable$jsii$toJson
- 
Constructor Details- 
CustomStateprotected CustomState(software.amazon.jsii.JsiiObjectRef objRef) 
- 
CustomStateprotected CustomState(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) 
- 
CustomState@Stability(Stable) public CustomState(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull CustomStateProps props) - Parameters:
- scope- This parameter is required.
- id- Descriptive identifier for this chainable. This parameter is required.
- props- This parameter is required.
 
 
- 
- 
Method Details- 
addCatch@Stability(Stable) @NotNull public CustomState addCatch(@NotNull IChainable handler, @Nullable CatchProps props) Add a recovery handler for this state.When a particular error occurs, execution will continue at the error handler instead of failing the state machine execution. - Parameters:
- handler- This parameter is required.
- props-
 
- 
addCatchAdd a recovery handler for this state.When a particular error occurs, execution will continue at the error handler instead of failing the state machine execution. - Parameters:
- handler- This parameter is required.
 
- 
addRetryAdd retry configuration for this state.This controls if and how the execution will be retried if a particular error occurs. - Parameters:
- props-
 
- 
addRetryAdd retry configuration for this state.This controls if and how the execution will be retried if a particular error occurs. 
- 
nextContinue normal execution with the given state.
- 
toStateJson@Stability(Stable) @NotNull public com.fasterxml.jackson.databind.node.ObjectNode toStateJson(@Nullable QueryLanguage queryLanguage) Returns the Amazon States Language object for this state.- Specified by:
- toStateJsonin class- State
- Parameters:
- queryLanguage-
 
- 
toStateJson@Stability(Stable) @NotNull public com.fasterxml.jackson.databind.node.ObjectNode toStateJson()Returns the Amazon States Language object for this state.- Specified by:
- toStateJsonin class- State
 
- 
getEndStatesContinuable states of this Chainable.- Specified by:
- getEndStatesin interface- IChainable
- Specified by:
- getEndStatesin class- State
 
 
-