DVA-C02 · Question #508
A developer needs to build a workflow to handle messages that are sent to an Amazon Simple Queue Service (Amazon SQS) queue. When a message reaches the queue, the workflow must implement a delay…
The correct answer is C. Set the DelaySeconds value of the SQS queue to be the number of seconds required to delay. This question tests the distinction between SQS DelaySeconds (initial delivery delay) and Visibility Timeout (post-receipt hiding) to implement a processing delay.
Question
A developer needs to build a workflow to handle messages that are sent to an Amazon Simple Queue Service (Amazon SQS) queue. When a message reaches the queue, the workflow must implement a delay before invoking an AWS Lambda function to process the message. Which solution will meet this requirement in the MOST operationally efficient way?
Options
- ACreate an AWS Step Functions state machine to process the SQS queue. Use a Wait state to
- BConfigure the Lambda function to poll the SQS queue. Update the Lambda code to republish
- CSet the DelaySeconds value of the SQS queue to be the number of seconds required to delay
- DSet the Visibility Timeout value of the SQS queue to be the number of seconds required to delay
How the community answered
(23 responses)- A13% (3)
- B4% (1)
- C78% (18)
- D4% (1)
Why each option
This question tests the distinction between SQS DelaySeconds (initial delivery delay) and Visibility Timeout (post-receipt hiding) to implement a processing delay.
Using an AWS Step Functions state machine with a Wait state adds significant architectural complexity and additional cost compared to the native, built-in SQS DelaySeconds feature.
Having Lambda republish messages to re-implement the delay requires custom code, doubles invocation costs, and is operationally inefficient compared to the native queue delay setting.
The SQS DelaySeconds attribute (0 to 900 seconds) makes newly enqueued messages invisible to consumers for the specified duration before they appear in the queue. Lambda polling the queue will not receive or invoke on the message until the delay period expires, implementing the required delay natively without additional code, state machines, or infrastructure.
Visibility Timeout controls how long a message is hidden from other consumers after it has already been received by one consumer, preventing duplicate processing; it does not delay the initial availability of a newly enqueued message.
Concept tested: SQS DelaySeconds for initial message delivery delay
Source: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-delay-queues.html
Community Discussion
No community discussion yet for this question.