An application needs to make use of an SQS queue for working with messages.
An SQS queue has been created with the default settings.
The application needs 60 seconds to process each message.
Which of the following step need to be carried out by the application?
Click on the arrows to vote for the correct answer
A. B. C. D.Answer - A.
If the SQS queue is created with the default settings, then the default visibility timeout is 30 seconds.
And since the application needs more time for processing, you first need to change the timeout and delete the message after it is processed.
Option B is incorrect since you need to process the message first.
Options C and D are incorrect since you need to change the visibility timeout for each message first.
For more information on SQS visibility timeout, please refer to the below URL-
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-visibility-timeout.htmlThe correct answer is C: Process the message, change the visibility timeout. Delete the message.
When a message is pulled from an SQS queue, it becomes invisible to other consumers for a specified period known as the visibility timeout. During this time, the application has exclusive access to the message and can process it without worrying about other consumers modifying the message.
In this scenario, since it takes the application 60 seconds to process each message, the visibility timeout must be set to a value higher than 60 seconds to ensure that the message doesn't become visible to other consumers before the application is done processing it.
Here's the step-by-step explanation of the correct answer:
Option A is incorrect because changing the visibility timeout for each message and then deleting it after processing is completed will result in the message becoming visible to other consumers before the application has finished processing it, which could result in the message being processed multiple times.
Option B is incorrect because deleting the message before changing the visibility timeout will result in the message becoming visible to other consumers before the application has finished processing it, which could result in the message being processed multiple times.
Option D is incorrect because deleting the message without changing the visibility timeout will result in the message becoming visible to other consumers immediately, which could result in the message being processed multiple times.