class WaitTime
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.StepFunctions.WaitTime |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsstepfunctions#WaitTime |
Java | software.amazon.awscdk.services.stepfunctions.WaitTime |
Python | aws_cdk.aws_stepfunctions.WaitTime |
TypeScript (source) | aws-cdk-lib » aws_stepfunctions » WaitTime |
Represents the Wait state which delays a state machine from continuing for a specified time.
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),
});
Methods
Name | Description |
---|---|
static duration(duration) | Wait a fixed amount of time. |
static seconds | Wait for a number of seconds stored in the state object. |
static timestamp(timestamp) | Wait until the given ISO8601 timestamp. |
static timestamp | Wait until a timestamp found in the state object. |
static duration(duration)
public static duration(duration: Duration): WaitTime
Parameters
- duration
Duration
Returns
Wait a fixed amount of time.
Path(path)
static secondspublic static secondsPath(path: string): WaitTime
Parameters
- path
string
Returns
Wait for a number of seconds stored in the state object.
Example value: $.waitSeconds
static timestamp(timestamp)
public static timestamp(timestamp: string): WaitTime
Parameters
- timestamp
string
Returns
Wait until the given ISO8601 timestamp.
Example value: 2016-03-14T01:59:00Z
Path(path)
static timestamppublic static timestampPath(path: string): WaitTime
Parameters
- path
string
Returns
Wait until a timestamp found in the state object.
Example value: $.waitTimestamp