DVA-C02 Question 396
Single answerYour application processes user-uploaded files and uses Amazon SQS to store metadata about the files. Occasionally, some messages are not processed due to application errors, and you want to ensure these unprocessed messages are captured for later analysis. How can you achieve this using Amazon SQS?
- A
Configure a Dead Letter Queue (DLQ) and associate it with your SQS queue.
- B
Enable message encryption for the SQS queue to prevent processing errors.
- C
Set the visibility timeout of the SQS queue to zero to automatically retry failed messages.
- D
Use Amazon SNS to forward unprocessed messages to another queue.
Show answer and explanation
Correct answer: A
Explanation
To handle unprocessed messages in Amazon SQS, you can configure a Dead Letter Queue (DLQ). When a message exceeds the maximum number of processing attempts specified in the redrive policy, it is moved to the DLQ. This allows you to analyze and debug these messages without losing them, ensuring better reliability and troubleshooting in your application.
- A. Correct.
Correct. A Dead Letter Queue (DLQ) can be associated with your SQS queue to capture messages that fail to be processed after a specified number of retries.
- B. Incorrect.
Incorrect. Message encryption protects data in transit and at rest but does not help in handling unprocessed messages.
- C. Incorrect.
Incorrect. Setting the visibility timeout to zero would cause immediate retries of messages, which does not solve the issue of capturing unprocessed messages.
- D. Incorrect.
Incorrect. While Amazon SNS can help with message broadcasting, it is not designed to forward unprocessed messages to another queue in the context of SQS.