You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.
Class: Aws::SQS::Queue
- Inherits:
-
Resources::Resource
- Object
- Resources::Resource
- Aws::SQS::Queue
- Defined in:
- (unknown)
Instance Attribute Summary collapse
-
#attributes ⇒ Hash<String,String>
readonly
A map of attributes to their respective values.
-
#url ⇒ String
readonly
Attributes inherited from Resources::Resource
Instance Method Summary collapse
-
#add_permission(options = {}) ⇒ Struct
Adds a permission to a queue for a specific principal.
-
#change_message_visibility_batch(options = {}) ⇒ Types::ChangeMessageVisibilityBatchResult
Changes the visibility timeout of multiple messages.
-
#dead_letter_source_queues(options = {}) ⇒ Collection<Queue>
Returns a Collection of Queue resources.
-
#delete ⇒ Struct
Deletes the queue specified by the
QueueUrl
, regardless of the queue's contents.Be careful with the
DeleteQueue
action: When you delete a queue, any messages in the queue are no longer available. -
#delete_messages(options = {}) ⇒ Types::DeleteMessageBatchResult
Deletes up to ten messages from the specified queue.
-
#initialize ⇒ Object
constructor
-
#message(receipt_handle) ⇒ Message
-
#purge ⇒ Struct
Deletes the messages in a queue specified by the
QueueURL
parameter.When you use the
PurgeQueue
action, you can't retrieve any messages deleted from a queue.The message deletion process takes up to 60 seconds.
-
#receive_messages(options = {}) ⇒ Array<Message>
-
#remove_permission(options = {}) ⇒ Struct
Revokes any permissions in the queue policy that matches the specified
Label
parameter.-
Only the owner of a queue can remove permissions from it.
-
Cross-account permissions don't apply to this action.
-
-
#send_message(options = {}) ⇒ Types::SendMessageResult
Delivers a message to the specified queue.
A message can include only XML, JSON, and unformatted text.
-
#send_messages(options = {}) ⇒ Types::SendMessageBatchResult
Delivers up to ten messages to the specified queue.
-
#set_attributes(options = {}) ⇒ Struct
Sets the value of one or more queue attributes.
Methods inherited from Resources::Resource
add_data_attribute, add_identifier, #data, data_attributes, #data_loaded?, identifiers, #load, #wait_until
Methods included from Resources::OperationMethods
#add_batch_operation, #add_operation, #batch_operation, #batch_operation_names, #batch_operations, #operation, #operation_names, #operations
Constructor Details
#initialize(url, options = {}) ⇒ Object #initialize(options = {}) ⇒ Object
Instance Attribute Details
#attributes ⇒ Hash<String,String> (readonly)
A map of attributes to their respective values.
#url ⇒ String (readonly)
Instance Method Details
#add_permission(options = {}) ⇒ Struct
Adds a permission to a queue for a specific principal. This allows sharing access to the queue.
When you create a queue, you have full control access rights for the queue. Only you, the owner of the queue, can grant or deny permissions to the queue. For more information about these permissions, see Allow Developers to Write Messages to a Shared Queue in the Amazon Simple Queue Service Developer Guide.
-
AddPermission
generates a policy for you. You can useSetQueueAttributes
to upload your policy. For more information, see Using Custom Policies with the Amazon SQS Access Policy Language in the Amazon Simple Queue Service Developer Guide. -
An Amazon SQS policy can have a maximum of 7 actions.
-
To remove the ability to change queue permissions, you must deny permission to the
AddPermission
,RemovePermission
, andSetQueueAttributes
actions in your IAM policy.
Some actions take lists of parameters. These lists are specified using the param.n
notation. Values of n
are integers starting from 1. For example, a parameter list with two elements looks like this:
&AttributeName.1=first
&AttributeName.2=second
Cross-account permissions don't apply to this action. For more information, see Grant Cross-Account Permissions to a Role and a User Name in the Amazon Simple Queue Service Developer Guide.
#change_message_visibility_batch(options = {}) ⇒ Types::ChangeMessageVisibilityBatchResult
Changes the visibility timeout of multiple messages. This is a batch version of ChangeMessageVisibility.
The result of the action on each message is reported individually in the response. You can send up to 10 ChangeMessageVisibility
requests with each ChangeMessageVisibilityBatch
action.
Because the batch request can result in a combination of successful and unsuccessful actions, you should check for batch errors even when the call returns an HTTP status code of 200
.
Some actions take lists of parameters. These lists are specified using the param.n
notation. Values of n
are integers starting from 1. For example, a parameter list with two elements looks like this:
&AttributeName.1=first
&AttributeName.2=second
#dead_letter_source_queues(options = {}) ⇒ Collection<Queue>
Returns a Collection of Aws::SQS::Queue resources. No API requests are made until you call an enumerable method on the collection. Client#list_dead_letter_source_queues will be called multiple times until every Aws::SQS::Queue has been yielded.
#delete ⇒ Struct
Deletes the queue specified by the QueueUrl
, regardless of the queue's contents.
Be careful with the DeleteQueue
action: When you delete a queue, any messages in the queue are no longer available.
When you delete a queue, the deletion process takes up to 60 seconds. Requests you send involving that queue during the 60 seconds might succeed. For example, a SendMessage
request might succeed, but after 60 seconds the queue and the message you sent no longer exist.
When you delete a queue, you must wait at least 60 seconds before creating a queue with the same name.
Cross-account permissions don't apply to this action. For more information, see Grant Cross-Account Permissions to a Role and a User Name in the Amazon Simple Queue Service Developer Guide.
#delete_messages(options = {}) ⇒ Types::DeleteMessageBatchResult
Deletes up to ten messages from the specified queue. This is a batch version of DeleteMessage.
The result of the action on each message is reported individually in the response.
Because the batch request can result in a combination of successful and unsuccessful actions, you should check for batch errors even when the call returns an HTTP status code of 200
.
Some actions take lists of parameters. These lists are specified using the param.n
notation. Values of n
are integers starting from 1. For example, a parameter list with two elements looks like this:
&AttributeName.1=first
&AttributeName.2=second
#message(receipt_handle) ⇒ Message
#purge ⇒ Struct
Deletes the messages in a queue specified by the QueueURL
parameter.
When you use the PurgeQueue
action, you can't retrieve any messages deleted from a queue.
The message deletion process takes up to 60 seconds. We recommend waiting for 60 seconds regardless of your queue's size.
Messages sent to the queue before you call PurgeQueue
might be received but are deleted within the next minute.
Messages sent to the queue after you call PurgeQueue
might be deleted while the queue is being purged.
#receive_messages(options = {}) ⇒ Array<Message>
#remove_permission(options = {}) ⇒ Struct
Revokes any permissions in the queue policy that matches the specified Label
parameter.
-
Only the owner of a queue can remove permissions from it.
-
Cross-account permissions don't apply to this action. For more information, see Grant Cross-Account Permissions to a Role and a User Name in the Amazon Simple Queue Service Developer Guide.
-
To remove the ability to change queue permissions, you must deny permission to the
AddPermission
,RemovePermission
, andSetQueueAttributes
actions in your IAM policy.
#send_message(options = {}) ⇒ Types::SendMessageResult
Delivers a message to the specified queue.
A message can include only XML, JSON, and unformatted text. The following Unicode characters are allowed:
#x9
| #xA
| #xD
| #x20
to #xD7FF
| #xE000
to #xFFFD
| #x10000
to #x10FFFF
Any characters not included in this list will be rejected. For more information, see the W3C specification for characters.
#send_messages(options = {}) ⇒ Types::SendMessageBatchResult
Delivers up to ten messages to the specified queue. This is a batch version of SendMessage.
For a FIFO queue, multiple messages within a single batch are enqueued in the order they are sent.
The result of sending each message is reported individually in the response. Because the batch request can result in a combination of successful and unsuccessful actions, you should check for batch errors even when the call returns an HTTP status code of 200
.
The maximum allowed individual message size and the maximum total payload size (the sum of the individual lengths of all of the batched messages) are both 256 KB (262,144 bytes).
A message can include only XML, JSON, and unformatted text. The following Unicode characters are allowed:
#x9
| #xA
| #xD
| #x20
to #xD7FF
| #xE000
to #xFFFD
| #x10000
to #x10FFFF
Any characters not included in this list will be rejected. For more information, see the W3C specification for characters.
If you don't specify the DelaySeconds
parameter for an entry, Amazon SQS uses the default value for the queue.
Some actions take lists of parameters. These lists are specified using the param.n
notation. Values of n
are integers starting from 1. For example, a parameter list with two elements looks like this:
&AttributeName.1=first
&AttributeName.2=second
#set_attributes(options = {}) ⇒ Struct
Sets the value of one or more queue attributes. When you change a queue's attributes, the change can take up to 60 seconds for most of the attributes to propagate throughout the Amazon SQS system. Changes made to the MessageRetentionPeriod
attribute can take up to 15 minutes.
-
In the future, new attributes might be added. If you write code that calls this action, we recommend that you structure your code so that it can handle new attributes gracefully.
-
Cross-account permissions don't apply to this action. For more information, see Grant Cross-Account Permissions to a Role and a User Name in the Amazon Simple Queue Service Developer Guide.
-
To remove the ability to change queue permissions, you must deny permission to the
AddPermission
,RemovePermission
, andSetQueueAttributes
actions in your IAM policy.