A developer is building a document conversion service where users upload files to be converted. The architecture uses an Amazon SQS queue to hold conversion tasks. A fleet of consumer instances running on Amazon ECS retrieves messages from the queue, processes the conversion (which takes up to 5 minutes per document), and then deletes the messages. During peak traffic, the developer notices that some documents are being processed multiple times by different container instances. Which two actions should the developer take to resolve this issue? (Select TWO)
- Increase the visibility timeout of the SQS queue to a value greater than 5 minutes.Answer
- Ensure the consumer application code calls DeleteMessage using the receipt handle of the message after the conversion is complete.Answer
- CDecrease the visibility timeout of the SQS queue to 1 minute to allow other container instances to quickly retry failed tasks.
- DEmbed the AWS access keys directly within the container application code to authenticate SDK calls to SQS.
- EIncrease the timeout of the AWS Lambda function that processes the queue to 15 minutes.
Answer
The developer should increase the visibility timeout of the SQS queue to a value greater than 5 minutes, and ensure the consumer application code calls DeleteMessage using the receipt handle of the message after the conversion is complete.
The correct options are increasing the SQS queue's visibility timeout and ensuring the consumer code calls DeleteMessage after successful processing. Increasing the visibility timeout to exceed the maximum processing duration (5 minutes) ensures that the message remains hidden from other consumers while being processed. Deleting the message using the receipt handle after conversion is complete ensures it is removed from the queue and not processed again.
Step-by-Step Solution
Key Concept
SQS message visibility timeout and deletion lifecycle