Cover by James Murty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

O'Reilly logo

Queue Attributes

SQS queues have attributes associated with them that can be queried and updated using API operations, and queues may have both editable and noneditable attributes. Editable attributes are configurable settings you can alter by adjusting the attribute. Noneditable attributes include system-generated information about a queue, such as the number of messages it contains.

In the 2007-05-01 version of the SQS Query API, two queue attributes are available:

VisibilityTimeout

The default visibility timeout for the queue; this value is configurable. It may be set when the queue is created and updated anytime afterwards.

ApproximateNumberOfMessages

The SQS system’s best estimate of the number of messages in the queue, including both visible and invisible messages; this value is generated by the system and can only be retrieved, not edited.

Note

This value can only be approximate due to the distributed nature of SQS.

Retrieve Queue Attributes

The GetQueueAttributes operation detailed in Table 8-10 retrieves a queue’s attribute settings.

Table 8-10. GetQueueAttributes request parameters

Parameter NameValueRequired?
ActionGetQueueAttributesYes
AttributeThe name of the queue attribute to retrieve, or All, in which case all the queue’s attributes are returned; valid values are: All, ApproximateNumberOfMessages, and VisibilityTimeoutYes

Here is an XML document returned by the operation. The document includes an AttributeValue element for each attribute retrieved. The AttributeValue element contains ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required