DVA-C02 · Question #429
A company has an application that uses an AWS Lambda function to consume messages from an Amazon Simple Queue Service (Amazon SQS) queue. The SQS queue is configured with a dead-letter queue. Due to a
The correct answer is A. Use the SendMessageBatch API to send messages from the dead-letter queue to the original. To reprocess messages stranded in a dead-letter queue, the developer must move them back to the source queue so the Lambda function can consume them again.
Question
A company has an application that uses an AWS Lambda function to consume messages from an Amazon Simple Queue Service (Amazon SQS) queue. The SQS queue is configured with a dead-letter queue. Due to a defect in the application, AWS Lambda failed to process some messages. A developer fixed the bug and wants to process the failed messages again. How should the developer resolve this issue?
Options
- AUse the SendMessageBatch API to send messages from the dead-letter queue to the original
- BUse the ChangeMessageVisibility API to configure messages in the dead-letter queue to be
- CUse the StartMessageMoveTask API to move messages from the dead-letter queue to the
- DUse the PurgeQueue API to remove messages from the dead-letter queue and return the
How the community answered
(41 responses)- A90% (37)
- B5% (2)
- C2% (1)
- D2% (1)
Why each option
To reprocess messages stranded in a dead-letter queue, the developer must move them back to the source queue so the Lambda function can consume them again.
Using the SendMessageBatch API, the developer can programmatically read messages from the dead-letter queue and send them back to the original SQS queue in batches. Once the messages are in the source queue, the Lambda event source mapping will automatically pick them up and process them with the fixed code.
ChangeMessageVisibility changes how long a message is invisible to consumers but does not move messages out of the dead-letter queue back to the original queue for reprocessing.
StartMessageMoveTask is used to move messages between queues in supported scenarios, but option A (SendMessageBatch) is the direct, widely supported API call for manually requeuing DLQ messages to the source queue.
PurgeQueue permanently deletes all messages in the dead-letter queue without processing them, which would result in permanent data loss.
Concept tested: Reprocessing SQS dead-letter queue messages after bug fix
Source: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html
Community Discussion
No community discussion yet for this question.