Skip to content

Commit

Permalink
updating examples to include the integrationPattern attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
shivlaks committed Mar 18, 2020
1 parent b8181d1 commit 8d542ee
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/@aws-cdk/aws-stepfunctions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ const submitLambda = new lambda.Function(this, 'SubmitLambda', { ... });
const getStatusLambda = new lambda.Function(this, 'CheckLambda', { ... });

const submitJob = new sfn.Task(this, 'Submit Job', {
task: new tasks.RunLambdaTask(submitLambda),
task: new tasks.RunLambdaTask(submitLambda, {
integrationPattern: sfn.ServiceIntegrationPattern.WAIT_FOR_TASK_TOKEN,
}),
// Put Lambda's result here in the execution's state object
resultPath: '$.guid',
});
Expand All @@ -45,7 +47,11 @@ const waitX = new sfn.Wait(this, 'Wait X Seconds', {
});

const getStatus = new sfn.Task(this, 'Get Job Status', {
task: new tasks.RunLambdaTask(getStatusLambda),
task: new tasks.RunLambdaTask(getStatusLambda, {
integrationPattern: sfn.ServiceIntegrationPattern.WAIT_FOR_TASK_TOKEN,
invocationType: tasks.InvocationType.REQUEST_RESPONSE,

}),
// Pass just the field named "guid" into the Lambda, put the
// Lambda's result in a field called "status"
inputPath: '$.guid',
Expand All @@ -61,6 +67,7 @@ const finalStatus = new sfn.Task(this, 'Get Final Job Status', {
task: new tasks.RunLambdaTask(getStatusLambda),
// Use "guid" field as input, output of the Lambda becomes the
// entire state machine output.
integrationPattern: sfn.ServiceIntegrationPattern.WAIT_FOR_TASK_TOKEN,
inputPath: '$.guid',
});

Expand Down

0 comments on commit 8d542ee

Please sign in to comment.