Class AWS::SQS::QueueCollection
In: lib/aws/sqs/queue_collection.rb
Parent: Object

Represents all the {Queue} objects in your account.

If you have permission to access a queue created by another account, you can also use this collection to access that queue by URL.

@example Printing the URLs of all queues

  pp sqs.queues.map(&:url)

@example Filtering queues by queue name prefix

  pp sqs.queues.with_prefix("production_").map(&:url)

@example Accessing a queue by URL

  url = "http://sqs.us-west-2.amazonaws.com/123456789012/myqueue"
  sqs.queues[url].send_message("HELLO")

Methods

[]   _each_item   create   named   new   url_for   with_prefix  

Included Modules

Core::Collection::Simple

Attributes

prefix  [R]  @return [String] The queue name prefix by which this
  collection is filtered.

Public Class methods

@api private

Public Instance methods

@return [Queue] The queue with the given URL.

Creates a new queue.

@note If you delete a queue, you must wait at least 60

  seconds before creating a queue with the same name.

@param [String] name The name to use for the queue created.

  Constraints: Maximum 80 characters; alphanumeric
  characters, hyphens (-), and underscores (_) are allowed.

  The name of the queue should be unique within your account.  If
  you provide the name of an existing queue with the same options
  it was created with then no error is raised and the existing
  queue will be returned.

@param [Hash] options

@option options [Integer] :visibility_timeout (30) The number of

  seconds a message received from a queue will be invisible to
  others when they ask to receive messages.

@option options [Policy] :policy A policy object or policy desription

  (a json string).

@option options [Integer] :maximum_message_size (65536) The maximum

  number of bytes a message can contain before Amazon SQS rejects
  it.

@option options [Integer] :delay_seconds The time in seconds that

  the delivery of all messages in the queue will be delayed.
  This can be overriden when sending a message to the queue.

@option options [Integer] :message_retention_period The number of

  seconds from 60 (1 minute) to 1209600 (14 days).  The default
  is 345600 (4 days).

@return [Queue] The newly created queue.

Returns the queue with the given name. This requires making a request to SQS to get the queue url. If you know the url, you should use {#[]} instead.

@example

  queue = AWS::SQS.new.queues.named('my-queue')

@param (see url_for) @option (see url_for) @return [Queue] Returns the queue with the given name.

Returns the url for the given queue.

@example

  sqs.queues.url_for('my-queue')
  #=> "https://sqs.us-east-1.amazonaws.com/123456789012/my-queue"

@param [String] queue_name The name of the queue you need a URL for.

@param [Hash] options

@option options [String] :queue_owner_aws_account_id The AWS account

  ID of the account that created the queue.  You can only get the
  url for queues in other accounts when the account owner has
  granted you permission.

@param [String] prefix The queue name prefix. @return [QueueCollection] A new collection representing only

  the queues whose names start with the given prefix.

Protected Instance methods

@yieldparam [Queue] queue Each {Queue} object in the collection.

[Validate]