@Generated(value="jsii-pacmak/1.74.0 (build 6d08790)", date="2023-03-22T19:35:43.502Z") public abstract class StateMachineFragment extends Construct implements IChainable
Example:
import software.amazon.awscdk.core.Stack; import software.constructs.Construct; import software.amazon.awscdk.services.stepfunctions.*; public class MyJobProps { private String jobFlavor; public String getJobFlavor() { return this.jobFlavor; } public MyJobProps jobFlavor(String jobFlavor) { this.jobFlavor = jobFlavor; return this; } } public class MyJob extends StateMachineFragment { public final State startState; public final INextable[] endStates; public MyJob(Construct parent, String id, MyJobProps props) { super(parent, id); Choice choice = new Choice(this, "Choice").when(Condition.stringEquals("$.branch", "left"), new Pass(this, "Left Branch")).when(Condition.stringEquals("$.branch", "right"), new Pass(this, "Right Branch")); // ... this.startState = choice; this.endStates = choice.afterwards().getEndStates(); } } public class MyStack extends Stack { public MyStack(Construct scope, String id) { super(scope, id); // Do 3 different variants of MyJob in parallel Parallel parallel = new Parallel(this, "All jobs").branch(new MyJob(this, "Quick", new MyJobProps().jobFlavor("quick")).prefixStates()).branch(new MyJob(this, "Medium", new MyJobProps().jobFlavor("medium")).prefixStates()).branch(new MyJob(this, "Slow", new MyJobProps().jobFlavor("slow")).prefixStates()); StateMachine.Builder.create(this, "MyStateMachine") .definition(parallel) .build(); } }
IChainable.Jsii$Default
IConstruct.Jsii$Default
Modifier | Constructor and Description |
---|---|
protected |
StateMachineFragment(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
StateMachineFragment(software.amazon.jsii.JsiiObjectRef objRef) |
protected |
StateMachineFragment(software.constructs.Construct scope,
java.lang.String id) |
Modifier and Type | Method and Description |
---|---|
abstract java.util.List<INextable> |
getEndStates()
The states to chain onto if this fragment is used.
|
java.lang.String |
getId()
Descriptive identifier for this chainable.
|
abstract State |
getStartState()
The start state of this state machine fragment.
|
Chain |
next(IChainable next)
Continue normal execution with the given state.
|
StateMachineFragment |
prefixStates()
Prefix the IDs of all states in this state machine fragment.
|
StateMachineFragment |
prefixStates(java.lang.String prefix)
Prefix the IDs of all states in this state machine fragment.
|
Parallel |
toSingleState()
Wrap all states in this state machine fragment up into a single state.
|
Parallel |
toSingleState(SingleStateOptions options)
Wrap all states in this state machine fragment up into a single state.
|
getNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesize, validate
protected StateMachineFragment(software.amazon.jsii.JsiiObjectRef objRef)
protected StateMachineFragment(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
protected StateMachineFragment(software.constructs.Construct scope, java.lang.String id)
scope
- This parameter is required.id
- This parameter is required.public Chain next(IChainable next)
next
- This parameter is required.public StateMachineFragment prefixStates(java.lang.String prefix)
Use this to avoid multiple copies of the state machine all having the same state IDs.
prefix
- The prefix to add.public StateMachineFragment prefixStates()
Use this to avoid multiple copies of the state machine all having the same state IDs.
public Parallel toSingleState(SingleStateOptions options)
This can be used to add retry or error handling onto this state machine fragment.
Be aware that this changes the result of the inner state machine to be an array with the result of the state machine in it. Adjust your paths accordingly. For example, change 'outputPath' to '$[0]'.
options
- public Parallel toSingleState()
This can be used to add retry or error handling onto this state machine fragment.
Be aware that this changes the result of the inner state machine to be an array with the result of the state machine in it. Adjust your paths accordingly. For example, change 'outputPath' to '$[0]'.
public abstract java.util.List<INextable> getEndStates()
getEndStates
in interface IChainable
public java.lang.String getId()
getId
in interface IChainable
public abstract State getStartState()
getStartState
in interface IChainable