AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
All
- returns all values.ApproximateNumberOfMessages
- returns the approximate number of visible messages in a queue. For more information,
see Resources
Required to Process Messages in the Amazon SQS Developer Guide.ApproximateNumberOfMessagesNotVisible
- returns the approximate number
of messages that are not timed-out and not deleted. For more information, see Resources
Required to Process Messages in the Amazon SQS Developer Guide.VisibilityTimeout
- returns the visibility timeout for the queue. For
more information about visibility timeout, see Visibility
Timeout in the Amazon SQS Developer Guide.CreatedTimestamp
- returns the time when the queue was created (epoch time in seconds).LastModifiedTimestamp
- returns the time when the queue was last changed (epoch time in seconds).Policy
- returns the queue's policy.MaximumMessageSize
- returns the limit of how many bytes a message can contain before Amazon SQS rejects
it.MessageRetentionPeriod
- returns the number of seconds
Amazon SQS retains a message.QueueArn
- returns the queue's
Amazon resource name (ARN).ApproximateNumberOfMessagesDelayed
- returns the approximate number of messages that are pending to be added to the queue.DelaySeconds
- returns the default delay on the queue in seconds.ReceiveMessageWaitTimeSeconds
- returns the time for which a ReceiveMessage
call will wait for a message to arrive.RedrivePolicy
- returns
the parameters for dead letter queue functionality of the source queue. For more information
about RedrivePolicy and dead letter queues, see Using
Amazon SQS Dead Letter Queues in the Amazon SQS Developer Guide.param.n
notation. Values of n
are integers starting from 1. For example, a parameter list with two elements looks
like this: &Attribute.1=this
&Attribute.2=that
Namespace: Amazon.SQS
Assembly: AWSSDK.dll
Version: (assembly version)
public virtual GetQueueAttributesResponse GetQueueAttributes( GetQueueAttributesRequest request )
Container for the necessary parameters to execute the GetQueueAttributes service method.
Exception | Condition |
---|---|
InvalidAttributeNameException | The attribute referred to does not exist. |
This example shows how to get queue attributes.
var client = new AmazonSQSClient(); var request = new GetQueueAttributesRequest { QueueUrl = "https://sqs.us-east-1.amazonaws.com/80398EXAMPLE/MyTestQueue", AttributeNames = new List<string>() { "All" } }; var response = client.GetQueueAttributes(request); Console.WriteLine("Attributes for queue ARN '" + response.QueueARN + "':"); Console.WriteLine(" Approximate number of messages:" + response.ApproximateNumberOfMessages); Console.WriteLine(" Approximate number of messages delayed: " + response.ApproximateNumberOfMessagesDelayed); Console.WriteLine(" Approximate number of messages not visible: " + response.ApproximateNumberOfMessagesNotVisible); Console.WriteLine(" Queue created on: " + response.CreatedTimestamp); Console.WriteLine(" Delay seconds: " + response.DelaySeconds); Console.WriteLine(" Queue last modified on: " + response.LastModifiedTimestamp); Console.WriteLine(" Maximum message size: " + response.MaximumMessageSize); Console.WriteLine(" Message retention period: " + response.MessageRetentionPeriod); Console.WriteLine(" Visibility timeout: " + response.VisibilityTimeout); Console.WriteLine(" Policy: " + response.Policy); Console.WriteLine(" Attributes:"); foreach (var attr in response.Attributes) { Console.WriteLine(" " + attr.Key + ": " + attr.Value); }
.NET Framework:
Supported in: 4.5, 4.0, 3.5