Created
June 11, 2020 07:23
-
-
Save masaedw/72f7482bd35ecfca3586d12b10350fc2 to your computer and use it in GitHub Desktop.
State 'task3' already has a next state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cdk = require("@aws-cdk/core"); | |
import sfn = require("@aws-cdk/aws-stepfunctions"); | |
import { Duration } from "@aws-cdk/core"; | |
export class SampleStack extends cdk.Stack { | |
constructor(app: cdk.App, id: string, props?: cdk.StackProps) { | |
super(app, id, props); | |
const task1 = new sfn.Wait(this, "task1", { | |
time: sfn.WaitTime.duration(Duration.minutes(1)), | |
}); | |
const task2 = new sfn.Wait(this, "task2", { | |
time: sfn.WaitTime.duration(Duration.seconds(60 / 4)), | |
}); | |
const task3 = new sfn.Wait(this, "task3", { | |
time: sfn.WaitTime.duration(Duration.seconds(60 / 4)), | |
}); | |
const task4 = new sfn.Choice(this, "task4"); | |
const cond1 = sfn.Condition.booleanEquals("$.hoge", true); | |
const cond2 = sfn.Condition.booleanEquals("$.fuga", true); | |
const task5 = new sfn.Wait(this, "task5", { | |
time: sfn.WaitTime.duration(Duration.seconds(5)), | |
}); | |
const task6 = new sfn.Wait(this, "task6", { | |
time: sfn.WaitTime.duration(Duration.seconds(5)), | |
}); | |
const task7 = new sfn.Wait(this, "task7", { | |
time: sfn.WaitTime.duration(Duration.seconds(5)), | |
}); | |
new sfn.StateMachine(this, "machine1", { | |
definition: task1 | |
.next(task2) | |
.next(task3) | |
.next( | |
task4 | |
.when(cond1, task2) | |
.when(cond2, task5) | |
.otherwise(task6) | |
.afterwards() | |
) | |
.next(task7), | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment