Class Parallel
Define a Parallel state in the state machine.
Inherited Members
Namespace: Amazon.CDK.AWS.StepFunctions
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class Parallel : State, IChainable, INextable
Syntax (vb)
Public Class Parallel Inherits State Implements IChainable, INextable
Remarks
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.
ExampleMetadata: nofixture infused
Examples
using Amazon.CDK;
using Constructs;
using Amazon.CDK.AWS.StepFunctions;
class MyJobProps
{
public string JobFlavor { get; set; }
}
class MyJob : StateMachineFragment
{
public State StartState { get; }
public INextable[] EndStates { get; }
public MyJob(Construct parent, string id, MyJobProps props) : base(parent, id)
{
var 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"));
// ...
StartState = choice;
EndStates = choice.Afterwards().EndStates;
}
}
class MyStack : Stack
{
public MyStack(Construct scope, string id) : base(scope, id)
{
// Do 3 different variants of MyJob in parallel
var 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());
new StateMachine(this, "MyStateMachine", new StateMachineProps {
DefinitionBody = DefinitionBody.FromChainable(parallel)
});
}
}
Synopsis
Constructors
Parallel(Construct, string, IParallelProps?) | Define a Parallel state in the state machine. |
Properties
EndStates | Continuable states of this Chainable. |
Methods
AddCatch(IChainable, ICatchProps?) | Add a recovery handler for this state. |
AddRetry(IRetryProps?) | Add retry configuration for this state. |
BindToGraph(StateGraph) | Overwrites State.bindToGraph. Adds branches to the Parallel state here so that any necessary prefixes are appended first. |
Branch(params IChainable[]) | Define one or more branches to run in parallel. |
JsonPath(Construct, string, IParallelJsonPathProps?) | Define a Parallel state using JSONPath in the state machine. |
Jsonata(Construct, string, IParallelJsonataProps?) | Define a Parallel state using JSONata in the state machine. |
Next(IChainable) | Continue normal execution with the given state. |
ToStateJson(QueryLanguage?) | Return the Amazon States Language object for this state. |
ValidateState() | Validate this state. |
Constructors
Parallel(Construct, string, IParallelProps?)
Define a Parallel state in the state machine.
public Parallel(Construct scope, string id, IParallelProps? props = null)
Parameters
- scope Construct
- id string
Descriptive identifier for this chainable.
- props IParallelProps
Remarks
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.
ExampleMetadata: nofixture infused
Properties
EndStates
Continuable states of this Chainable.
public override INextable[] EndStates { get; }
Property Value
Overrides
Remarks
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.
ExampleMetadata: nofixture infused
Methods
AddCatch(IChainable, ICatchProps?)
Add a recovery handler for this state.
public virtual Parallel AddCatch(IChainable handler, ICatchProps? props = null)
Parameters
- handler IChainable
- props ICatchProps
Returns
Remarks
When a particular error occurs, execution will continue at the error handler instead of failing the state machine execution.
AddRetry(IRetryProps?)
Add retry configuration for this state.
public virtual Parallel AddRetry(IRetryProps? props = null)
Parameters
- props IRetryProps
Returns
Remarks
This controls if and how the execution will be retried if a particular error occurs.
BindToGraph(StateGraph)
Overwrites State.bindToGraph. Adds branches to the Parallel state here so that any necessary prefixes are appended first.
public override void BindToGraph(StateGraph graph)
Parameters
- graph StateGraph
Overrides
Remarks
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.
ExampleMetadata: nofixture infused
Branch(params IChainable[])
Define one or more branches to run in parallel.
public virtual Parallel Branch(params IChainable[] branches)
Parameters
- branches IChainable[]
Returns
Remarks
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.
ExampleMetadata: nofixture infused
JsonPath(Construct, string, IParallelJsonPathProps?)
Define a Parallel state using JSONPath in the state machine.
public static Parallel JsonPath(Construct scope, string id, IParallelJsonPathProps? props = null)
Parameters
- scope Construct
- id string
- props IParallelJsonPathProps
Returns
Remarks
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.
Jsonata(Construct, string, IParallelJsonataProps?)
Define a Parallel state using JSONata in the state machine.
public static Parallel Jsonata(Construct scope, string id, IParallelJsonataProps? props = null)
Parameters
- scope Construct
- id string
- props IParallelJsonataProps
Returns
Remarks
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.
Next(IChainable)
Continue normal execution with the given state.
public virtual Chain Next(IChainable next)
Parameters
- next IChainable
Returns
Remarks
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.
ExampleMetadata: nofixture infused
ToStateJson(QueryLanguage?)
Return the Amazon States Language object for this state.
public override JObject ToStateJson(QueryLanguage? topLevelQueryLanguage = null)
Parameters
- topLevelQueryLanguage QueryLanguage?
Returns
JObject
Overrides
Remarks
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.
ExampleMetadata: nofixture infused
ValidateState()
Validate this state.
protected override string[] ValidateState()
Returns
string[]
Overrides
Remarks
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.
ExampleMetadata: nofixture infused