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(By |
Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Parallel(Deputy |
Used by jsii to construct an instance of this class from DeputyProps |
Parallel(Construct, String, IParallel |
Properties
End |
Continuable states of this Chainable. |
Methods
Add |
Add a recovery handler for this state. |
Add |
Add retry configuration for this state. |
Bind |
Overwrites State.bindToGraph. Adds branches to the Parallel state here so that any necessary prefixes are appended first. |
Branch(IChainable[]) | Define one or more branches to run in parallel. |
Jsonata(Construct, String, IParallel |
Define a Parallel state using JSONata in the state machine. |
Json |
Define a Parallel state using JSONPath in the state machine. |
Next(IChainable) | Continue normal execution with the given state. |
ToStateJson(Nullable<QueryLanguage>) | Return the Amazon States Language object for this state. |
Validate |
Validate this state. |
Constructors
Parallel(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Parallel(ByRefValue reference)
Parameters
- reference Amazon.
JSII. Runtime. Deputy. By Ref Value The Javascript-owned object reference
Parallel(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Parallel(DeputyBase.DeputyProps props)
Parameters
- props Amazon.
JSII. Runtime. Deputy. Deputy Base. Deputy Props The deputy props
Parallel(Construct, String, IParallelProps)
public Parallel(Construct scope, string id, IParallelProps props = null)
Parameters
- scope Constructs.
Construct - id System.
String Descriptive identifier for this chainable.
- props IParallel
Props
Properties
EndStates
Continuable states of this Chainable.
public override INextable[] EndStates { get; }
Property Value
Overrides
Methods
AddCatch(IChainable, ICatchProps)
Add a recovery handler for this state.
public virtual Parallel AddCatch(IChainable handler, ICatchProps props = null)
Parameters
- handler IChainable
- props ICatch
Props
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 IRetry
Props
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 State
Graph
Overrides
Branch(IChainable[])
Define one or more branches to run in parallel.
public virtual Parallel Branch(params IChainable[] branches)
Parameters
- branches IChainable[]
Returns
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 Constructs.
Construct - id System.
String - props IParallel
Jsonata Props
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.
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 Constructs.
Construct - id System.
String - props IParallel
Json Path Props
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
ToStateJson(Nullable<QueryLanguage>)
Return the Amazon States Language object for this state.
public override JObject ToStateJson(Nullable<QueryLanguage> topLevelQueryLanguage = null)
Parameters
- topLevelQueryLanguage System.
Nullable <QueryLanguage >
Returns
Newtonsoft.
Overrides
ValidateState()
Validate this state.
protected override string[] ValidateState()
Returns
System.