class Wait (construct)
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.StepFunctions.Wait |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsstepfunctions#Wait |
Java | software.amazon.awscdk.services.stepfunctions.Wait |
Python | aws_cdk.aws_stepfunctions.Wait |
TypeScript (source) | aws-cdk-lib » aws_stepfunctions » Wait |
Implements
IConstruct, IDependable, IChainable, INextable
Define a Wait state in the state machine.
A Wait state can be used to delay execution of the state machine for a while.
Example
const convertToSeconds = new tasks.EvaluateExpression(this, 'Convert to seconds', {
expression: '$.waitMilliseconds / 1000',
resultPath: '$.waitSeconds',
});
const createMessage = new tasks.EvaluateExpression(this, 'Create message', {
// Note: this is a string inside a string.
expression: '`Now waiting ${$.waitSeconds} seconds...`',
runtime: lambda.Runtime.NODEJS_LATEST,
resultPath: '$.message',
});
const publishMessage = new tasks.SnsPublish(this, 'Publish message', {
topic: new sns.Topic(this, 'cool-topic'),
message: sfn.TaskInput.fromJsonPathAt('$.message'),
resultPath: '$.sns',
});
const wait = new sfn.Wait(this, 'Wait', {
time: sfn.WaitTime.secondsPath('$.waitSeconds'),
});
new sfn.StateMachine(this, 'StateMachine', {
definition: convertToSeconds
.next(createMessage)
.next(publishMessage)
.next(wait),
});
Initializer
new Wait(scope: Construct, id: string, props: WaitProps)
Parameters
Construct Props
| Name | Type | Description |
|---|---|---|
| time | Wait | Wait duration. |
| assign? | { [string]: any } | Workflow variables to store in this step. |
| comment? | string | A comment describing this state. |
| query | Query | The name of the query language used by the state. |
| state | string | Optional name for this state. |
time
Type:
Wait
Wait duration.
assign?
Type:
{ [string]: any }
(optional, default: Not assign variables)
Workflow variables to store in this step.
Using workflow variables, you can store data in a step and retrieve that data in future steps.
See also: https://docs.aws.amazon.com/step-functions/latest/dg/workflow-variables.html
comment?
Type:
string
(optional, default: No comment)
A comment describing this state.
queryLanguage?
Type:
Query
(optional, default: JSONPath)
The name of the query language used by the state.
If the state does not contain a queryLanguage field,
then it will use the query language specified in the top-level queryLanguage field.
stateName?
Type:
string
(optional, default: The construct ID will be used as state name)
Optional name for this state.
Properties
| Name | Type | Description |
|---|---|---|
| end | INextable[] | Continuable states of this Chainable. |
| id | string | Descriptive identifier for this chainable. |
| node | Node | The tree node. |
| start | State | First state of this Chainable. |
| state | string | Tokenized string that evaluates to the state's ID. |
endStates
Type:
INextable[]
Continuable states of this Chainable.
id
Type:
string
Descriptive identifier for this chainable.
node
Type:
Node
The tree node.
startState
Type:
State
First state of this Chainable.
stateId
Type:
string
Tokenized string that evaluates to the state's ID.
Methods
| Name | Description |
|---|---|
| add | Add a prefix to the stateId of this state. |
| bind | Register this state as part of the given graph. |
| next(next) | Continue normal execution with the given state. |
| to | Return the Amazon States Language object for this state. |
| to | Returns a string representation of this construct. |
| with(...mixins) | Applies one or more mixins to this construct. |
| static json | Define a Wait state using JSONPath in the state machine. |
| static jsonata(scope, id, props) | Define a Wait state using JSONata in the state machine. |
addPrefix(x)
public addPrefix(x: string): void
Parameters
- x
string
Add a prefix to the stateId of this state.
bindToGraph(graph)
public bindToGraph(graph: StateGraph): void
Parameters
- graph
StateGraph
Register this state as part of the given graph.
Don't call this. It will be called automatically when you work with states normally.
next(next)
public next(next: IChainable): Chain
Parameters
- next
IChainable
Returns
Continue normal execution with the given state.
toStateJson(topLevelQueryLanguage?)
public toStateJson(topLevelQueryLanguage?: QueryLanguage): json
Parameters
- topLevelQueryLanguage
QueryLanguage
Returns
json
Return the Amazon States Language object for this state.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
with(...mixins)
public with(...mixins: IMixin[]): IConstruct
Parameters
- mixins
IMixin— The mixins to apply.
Returns
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
static jsonPath(scope, id, props)
public static jsonPath(scope: Construct, id: string, props: WaitJsonPathProps): Wait
Parameters
- scope
Construct - id
string - props
WaitJson Path Props
Returns
Define a Wait state using JSONPath in the state machine.
A Wait state can be used to delay execution of the state machine for a while.
static jsonata(scope, id, props)
public static jsonata(scope: Construct, id: string, props: WaitJsonataProps): Wait
Parameters
- scope
Construct - id
string - props
WaitJsonata Props
Returns
Define a Wait state using JSONata in the state machine.
A Wait state can be used to delay execution of the state machine for a while.

.NET
Go
Java
Python
TypeScript (