DVA-C02 · Question #500
A developer is creating an AWS Step Functions state machine to handle an order processing workflow. When the state machine receives an order, the state machine pauses until the order has been confirme
The correct answer is B. Subscribe an AWS Lambda function to a DynamoDB table stream. Configure the Lambda. This question tests the Step Functions callback pattern using DynamoDB Streams and a task token to pause workflow execution until an external event occurs.
Question
A developer is creating an AWS Step Functions state machine to handle an order processing workflow. When the state machine receives an order, the state machine pauses until the order has been confirmed. A record that is added to an Amazon DynamoDB table by another service confirms each order. The developer must complete the order processing workflow. Which solution will meet this requirement?
Options
- AUpdate the state machine to query the DynamoDB table by using the DynamoDB GetItem state to
- BSubscribe an AWS Lambda function to a DynamoDB table stream. Configure the Lambda
- CSubscribe an AWS Lambda function to the DynamoDB table stream. Configure the Lambda
- DInvoke an AWS Lambda function from the state machine. Configure the Lambda function to
How the community answered
(45 responses)- A20% (9)
- B42% (19)
- C29% (13)
- D9% (4)
Why each option
This question tests the Step Functions callback pattern using DynamoDB Streams and a task token to pause workflow execution until an external event occurs.
Polling DynamoDB with a GetItem state in a loop wastes compute resources and requires custom retry logic rather than leveraging the native event-driven callback pattern.
The correct approach uses Step Functions' waitForTaskToken callback pattern. A Lambda function subscribed to the DynamoDB Streams event receives the new confirmation record, then calls the Step Functions SendTaskSuccess API with the embedded task token, resuming the paused state machine execution in an event-driven, non-polling manner.
This option configures the Lambda incorrectly or without the task token callback, so it cannot properly signal Step Functions to resume the paused execution.
Invoking a Lambda to poll or wait for confirmation is less efficient than using the DynamoDB Streams event-driven trigger with the waitForTaskToken callback.
Concept tested: Step Functions waitForTaskToken callback pattern with DynamoDB Streams
Source: https://docs.aws.amazon.com/step-functions/latest/dg/connect-to-resource.html#connect-wait-token
Community Discussion
No community discussion yet for this question.