Skip to content
23K
Console

Parallel

The Parallel state is internally used by the StepFunctions component to add a Parallel workflow state to a state machine.

You’ll find this component returned by the parallel method of the StepFunctions component.


Constructor

new Parallel(args)

Parameters

ParallelArgs

arguments?

Type Input<Record<string, Input<any>>>

Used to pass information to the API actions of connected resources. Values can include JSONata expressions. For more information, see Transforming data with JSONata in Step Functions.

{
arguments: {
product: "{% $states.input.order.product %}",
count: 32
}
}

assign?

Type Record<string, any>

Used to store variables. The Assign field accepts a JSON object with key/value pairs that define variable names and their assigned values. Alternatively, you can pass in a JSONata expression directly.

For more information, see Passing data between states with variables.

Provide a JSON object with variable names and values.

{
assign: {
productName: "product1",
count: 42,
available: true,
}
}

Assign values from state input and result using JSONata expressions.

{
assign: {
product: "{% $states.input.order.product %}",
currentPrice: "{% $states.result.Payload.current_price %}"
}
}

comment?

Type Input<string>

A comment to describe the state.

name

Type string

The name of the state.

output?

Type Input<Record<string, any> | {% ${string} %}>

Specify and transform output from the state. When specified, the value overrides the state output default.

The output field accepts any JSON value (object, array, string, number, boolean, null). Alternatively, you can pass in a JSONata expression directly.

For more information, see Transforming data with JSONata in Step Functions.

Methods

branch

branch(branch)

Parameters

  • branch State

    The state to add as a branch.

Returns Parallel

Add a branch to the Parallel state. Each branch runs concurrently.

catch

catch(state, args?)

Parameters

  • state State

    The state to transition to on error.
  • args? CatchArgs

    Optional catch properties to customize error handling.

Returns Parallel

Add catch behavior to the Parallel state. If the state fails with any of the specified errors, continue execution with the given state.

next

next(state)

Parameters

  • state State

    The state to transition to.

Returns State

Add a next state to the Parallel state. If all branches complete successfully, continue execution with the given state.

retry

retry(args?)

Parameters

  • args? RetryArgs

    Optional retry properties to customize retry behavior.

Returns Parallel

Add retry behavior to the Parallel state. If the state fails with any of the specified errors, retry execution using the specified parameters.