Class Chain
A collection of states to chain onto.
Inheritance
Implements
Namespace: Amazon.CDK.AWS.StepFunctions
Assembly: Amazon.CDK.AWS.StepFunctions.dll
Syntax (csharp)
public class Chain : DeputyBase, IChainable
Syntax (vb)
Public Class Chain
Inherits DeputyBase
Implements IChainable
Remarks
A Chain has a start and zero or more chainable ends. If there are zero ends, calling next() on the Chain will fail.
ExampleMetadata: infused
Examples
// Define a state machine with one Pass state
var child = new StateMachine(this, "ChildStateMachine", new StateMachineProps {
Definition = Chain.Start(new Pass(this, "PassState"))
});
// Include the state machine in a Task state with callback pattern
var task = new StepFunctionsStartExecution(this, "ChildTask", new StepFunctionsStartExecutionProps {
StateMachine = child,
IntegrationPattern = IntegrationPattern.WAIT_FOR_TASK_TOKEN,
Input = TaskInput.FromObject(new Dictionary<string, object> {
{ "token", JsonPath.TaskToken },
{ "foo", "bar" }
}),
Name = "MyExecutionName"
});
// Define a second state machine with the Task state above
// Define a second state machine with the Task state above
new StateMachine(this, "ParentStateMachine", new StateMachineProps {
Definition = task
});
Synopsis
Constructors
Chain(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Chain(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
EndStates | The chainable end state(s) of this chain. |
Id | Identify this Chain. |
StartState | The start state of this chain. |
Methods
Custom(State, INextable[], IChainable) | Make a Chain with specific start and end states, and a last-added Chainable. |
Next(IChainable) | Continue normal execution with the given state. |
Sequence(IChainable, IChainable) | Make a Chain with the start from one chain and the ends from another. |
Start(IChainable) | Begin a new Chain from one chainable. |
ToSingleState(String, IParallelProps) | Return a single state that encompasses all states in the chain. |
Constructors
Chain(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Chain(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Chain(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Chain(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
EndStates
The chainable end state(s) of this chain.
public virtual INextable[] EndStates { get; }
Property Value
Id
Identify this Chain.
public virtual string Id { get; }
Property Value
System.String
StartState
Methods
Custom(State, INextable[], IChainable)
Make a Chain with specific start and end states, and a last-added Chainable.
public static Chain Custom(State startState, INextable[] endStates, IChainable lastAdded)
Parameters
- startState State
- endStates INextable[]
- lastAdded IChainable
Returns
Next(IChainable)
Continue normal execution with the given state.
public virtual Chain Next(IChainable next)
Parameters
- next IChainable
Returns
Sequence(IChainable, IChainable)
Make a Chain with the start from one chain and the ends from another.
public static Chain Sequence(IChainable start, IChainable next)
Parameters
- start IChainable
- next IChainable
Returns
Start(IChainable)
Begin a new Chain from one chainable.
public static Chain Start(IChainable state)
Parameters
- state IChainable
Returns
ToSingleState(String, IParallelProps)
Return a single state that encompasses all states in the chain.
public virtual Parallel ToSingleState(string id, IParallelProps props = null)
Parameters
- id System.String
- props IParallelProps
Returns
Remarks
This can be used to add error handling to a sequence of states.
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]'.