16. ステートマシン
16
import * as sfn from ‘@aws-cdk/aws-stepfunctions’;
const sampleTask1 = new sfn.Task(this, ‘SampleTask1’, { // ①
task: new tasks.InvokeFunction(sampleFunc1),
});
const sampleTask2 = new sfn.Task(this, ‘SampleTask2’, { // ②
task: new tasks.InvokeFunction(sampleFunc2),
});
const errorTask = new sfn.Task(this, ‘ErrorMail’, { // ③
task: new tasks.PublishToTopic(emailTopic, {
subject: `Error`,
message: sfn.TaskInput.fromDataAt('$.*'),
}),
});
const fail = new sfn.Fail(this, 'Fail’); // ④
errorTask.next(fail); // ⑤
①
②
③
④
⑤