@Generated(value="jsii-pacmak/1.54.0 (build b1b977a)", date="2022-02-19T00:19:34.320Z") @Stability(value=Stable) public class Parallel extends State implements INextable
A Parallel state can be used to run one or more state machines at the same time.
The Result of a Parallel state is an array of the results of its substatemachines.
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();
}
}
| Modifier and Type | Class and Description |
|---|---|
static class |
Parallel.Builder
A fluent builder for
Parallel. |
software.amazon.jsii.JsiiObject.InitializationModeINextable.Jsii$Default, INextable.Jsii$ProxyIChainable.Jsii$DefaultIConstruct.Jsii$Default| Modifier | Constructor and Description |
|---|---|
|
Parallel(software.constructs.Construct scope,
String id) |
|
Parallel(software.constructs.Construct scope,
String id,
ParallelProps props) |
protected |
Parallel(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) |
protected |
Parallel(software.amazon.jsii.JsiiObjectRef objRef) |
| Modifier and Type | Method and Description |
|---|---|
Parallel |
addCatch(IChainable handler)
Add a recovery handler for this state.
|
Parallel |
addCatch(IChainable handler,
CatchProps props)
Add a recovery handler for this state.
|
Parallel |
addRetry()
Add retry configuration for this state.
|
Parallel |
addRetry(RetryProps props)
Add retry configuration for this state.
|
void |
bindToGraph(StateGraph graph)
Overwrites State.bindToGraph.
|
Parallel |
branch(IChainable... branches)
Define one or more branches to run in parallel.
|
List<INextable> |
getEndStates()
Continuable states of this Chainable.
|
Chain |
next(IChainable next)
Continue normal execution with the given state.
|
com.fasterxml.jackson.databind.node.ObjectNode |
toStateJson()
Return the Amazon States Language object for this state.
|
protected List<String> |
validate()
Validate this state.
|
addBranch, addChoice, addIterator, addPrefix, filterNextables, findReachableEndStates, findReachableEndStates, findReachableStates, findReachableStates, getBranches, getComment, getDefaultChoice, getId, getInputPath, getIteration, getOutputPath, getParameters, getResultPath, getResultSelector, getStartState, getStateId, makeDefault, makeNext, prefixStates, renderBranches, renderChoices, renderInputOutput, renderIterator, renderNextEnd, renderResultSelector, renderRetryCatch, setDefaultChoice, setIteration, whenBoundToGraphgetNode, isConstruct, onPrepare, onSynthesize, onValidate, prepare, synthesizejsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetprotected Parallel(software.amazon.jsii.JsiiObjectRef objRef)
protected Parallel(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
@Stability(value=Stable)
public Parallel(@NotNull
software.constructs.Construct scope,
@NotNull
String id,
@Nullable
ParallelProps props)
scope - This parameter is required.id - This parameter is required.props - @Stability(value=Stable)
public Parallel(@NotNull
software.constructs.Construct scope,
@NotNull
String id)
scope - This parameter is required.id - This parameter is required.@Stability(value=Stable) @NotNull public Parallel addCatch(@NotNull IChainable handler, @Nullable CatchProps props)
When a particular error occurs, execution will continue at the error handler instead of failing the state machine execution.
handler - This parameter is required.props - @Stability(value=Stable) @NotNull public Parallel addCatch(@NotNull IChainable handler)
When a particular error occurs, execution will continue at the error handler instead of failing the state machine execution.
handler - This parameter is required.@Stability(value=Stable) @NotNull public Parallel addRetry(@Nullable RetryProps props)
This controls if and how the execution will be retried if a particular error occurs.
props - @Stability(value=Stable) @NotNull public Parallel addRetry()
This controls if and how the execution will be retried if a particular error occurs.
@Stability(value=Stable)
public void bindToGraph(@NotNull
StateGraph graph)
bindToGraph in class Stategraph - This parameter is required.@Stability(value=Stable) @NotNull public Parallel branch(@NotNull IChainable... branches)
branches - This parameter is required.@Stability(value=Stable) @NotNull public Chain next(@NotNull IChainable next)
@Stability(value=Stable) @NotNull public com.fasterxml.jackson.databind.node.ObjectNode toStateJson()
toStateJson in class State@Stability(value=Stable) @NotNull public List<INextable> getEndStates()
getEndStates in interface IChainablegetEndStates in class StateCopyright © 2022. All rights reserved.