@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:42.405Z") @Stability(value=Stable) public abstract class StateMachineFragment extends software.constructs.Construct implements IChainable
Example:
import software.amazon.awscdk.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();
}
}
software.amazon.jsii.JsiiObject.InitializationModeIChainable.Jsii$Default| Modifier | Constructor and Description |
|---|---|
protected |
StateMachineFragment(software.constructs.Construct scope,
String id)
Creates a new construct node.
|
protected |
StateMachineFragment(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
StateMachineFragment(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
abstract List<INextable> |
getEndStates()
The states to chain onto if this fragment is used.
|
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(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.
|
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected StateMachineFragment(software.amazon.jsii.JsiiObjectRef objRef)
protected StateMachineFragment(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
protected StateMachineFragment(@NotNull
software.constructs.Construct scope,
@NotNull
String id)
scope - The scope in which to define this construct. This parameter is required.id - The scoped construct ID. This parameter is required.@Stability(value=Stable) @NotNull public Chain next(@NotNull IChainable next)
next - This parameter is required.@Stability(value=Stable) @NotNull public StateMachineFragment prefixStates(@Nullable String prefix)
Use this to avoid multiple copies of the state machine all having the same state IDs.
prefix - The prefix to add.@Stability(value=Stable) @NotNull public StateMachineFragment prefixStates()
Use this to avoid multiple copies of the state machine all having the same state IDs.
@Stability(value=Stable) @NotNull public Parallel toSingleState(@Nullable 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 - @Stability(value=Stable) @NotNull 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]'.
@Stability(value=Stable) @NotNull public abstract List<INextable> getEndStates()
getEndStates in interface IChainable@Stability(value=Stable) @NotNull public String getId()
getId in interface IChainable@Stability(value=Stable) @NotNull public abstract State getStartState()
getStartState in interface IChainableCopyright © 2022. All rights reserved.