Views
2 weeks ago

sqsputapi

Amazon Simple Queue

Amazon Simple Queue Service Developer Guide Message Lifecycle Extending a Message's Visibility Timeout When you receive a message from the queue, you might find the visibility timeout for the queue is insufficient to fully process and delete that message. Amazon SQS allows you to extend the visibility timeout for that particular message. When you extend the visibility timeout, Amazon SQS overwrites the original timeout value and the new value begins at the time you changed it. For example, let's say the timeout for the queue is 30 seconds, and you receive a message. Once you're 20 seconds into the timeout for that message (i.e., you have 10 seconds left), you extend it by 60 seconds by calling ChangeMessageVisibility with VisibilityTimeoutset to 60 seconds.You have then changed the remaining visibility timeout from 10 seconds to 60 seconds. The extension you request is not stored in memory for that message. If for some reason you don't delete the message and the message is received again, the visibility timeout for the message the next time it's received is the overall value for the queue and not the extended value you previously set. Terminating a Message's Visibility Timeout When you receive a message from the queue, you might find that you actually don't want to process and delete that message. Amazon SQS allows you to terminate the visibility timeout for a specific message, which immediately makes the message visible to other components in the system to process. To do this, you call ChangeMessageVisibility with VisibilityTimeout=0 seconds. API Actions Related to Visibility Timeout The following table lists the API actions to use to manipulate the visibility timeout. To do this... Set the visibility timeout for a queue Get the visibility timeout for a queue Set the visibility timeout for the received messages without affecting the queue's visibility timeout Extending or terminating a message's visibility timeout Use this action SetQueueAttributes GetQueueAttributes ReceiveMessage and set the VisibilityTimeout parameter to the value you want ChangeMessageVisibility Message Lifecycle The following diagram and process describe the lifecycle of an Amazon SQS message, called Message A, from creation to deletion. Assume that a queue already exists. API Version 2009-02-01 9

Amazon Simple Queue Service Developer Guide AWS Identity and Access Management Message Lifecycle Component 1 sends Message A to a queue and the message is redundantly distributed across the SQS servers. When Component 2 is ready to process a message, it retrieves messages from the queue, and Message A is returned. While Message A is being processed, it remains in the queue and is not returned to subsequent receive requests for the duration of the visibility timeout. Component 2 deletes Message A from the queue to avoid the message being received and processed again once the visibility timeout expires. Note SQS automatically deletes messages that have been in a queue for more than 4 days. AWS Identity and Access Management Amazon SQS integrates with AWS Identity and Access Management (IAM), a service that lets your organization do the following: API Version 2009-02-01 10

amgrade sqs-dg-2009-02-01