You are viewing documentation for version 1 of the AWS SDK for Ruby. Version 2 documentation can be found here.

Class: AWS::SQS::Client

Inherits:
Core::QueryClient show all
Defined in:
lib/aws/sqs/client.rb

Overview

Client class for Amazon Simple Queue Service (SQS).

Direct Known Subclasses

V20121105

Defined Under Namespace

Classes: V20121105

Constant Summary

API_VERSION =
'2012-11-05'

Instance Attribute Summary

Attributes inherited from Core::Client

#config

Instance Method Summary collapse

Methods inherited from Core::Client

#initialize, #log_warning, #operations, #with_http_handler, #with_options

Constructor Details

This class inherits a constructor from AWS::Core::Client

Instance Method Details

#add_permission(options = {}) ⇒ Core::Response

Calls the AddPermission API operation.

Parameters:

  • options (Hash) (defaults to: {})
    • :queue_url - required - (String) The URL of the Amazon SQS queue to take action on.
    • :label - required - (String) The unique identification of the permission you're setting (e.g., AliceSendMessage). Constraints: Maximum 80 characters; alphanumeric characters, hyphens (-), and underscores (_) are allowed.
    • :aws_account_ids - required - (Array<) The AWS account number of the principal who will be given permission. The principal must have an AWS account, but does not need to be signed up for Amazon SQS. For information about locating the AWS account identification, see Your AWS Identifiers in the Amazon SQS Developer Guide.
    • :actions - required - (Array<) The action the client wants to allow for the specified principal. The following are valid values: * | SendMessage | ReceiveMessage | DeleteMessage | ChangeMessageVisibility | GetQueueAttributes | GetQueueUrl. For more information about these actions, see Understanding Permissions in the Amazon SQS Developer Guide. Specifying SendMessage, DeleteMessage, or ChangeMessageVisibility for the ActionName.n also grants permissions for the corresponding batch versions of those actions: SendMessageBatch, DeleteMessageBatch, and ChangeMessageVisibilityBatch.

Returns:

#change_message_visibility(options = {}) ⇒ Core::Response

Calls the ChangeMessageVisibility API operation.

Parameters:

  • options (Hash) (defaults to: {})
    • :queue_url - required - (String) The URL of the Amazon SQS queue to take action on.
    • :receipt_handle - required - (String) The receipt handle associated with the message whose visibility timeout should be changed. This parameter is returned by the ReceiveMessage action.
    • :visibility_timeout - required - (Integer) The new value (in seconds - from 0 to 43200 - maximum 12 hours) for the message's visibility timeout.

Returns:

#change_message_visibility_batch(options = {}) ⇒ Core::Response

Calls the ChangeMessageVisibilityBatch API operation.

Parameters:

  • options (Hash) (defaults to: {})
    • :queue_url - required - (String) The URL of the Amazon SQS queue to take action on.
    • :entries - required - (Array<) A list of receipt handles of the messages for which the visibility timeout must be changed.
      • :id - required - (String) An identifier for this particular receipt handle. This is used to communicate the result. Note that the Ids of a batch request need to be unique within the request.
      • :receipt_handle - required - (String) A receipt handle.
      • :visibility_timeout - (Integer) The new value (in seconds) for the message's visibility timeout.

Returns:

  • (Core::Response)

    The #data method of the response object returns a hash with the following structure:

    • :successful - (Array)
      • :id - (String)
    • :failed - (Array)
      • :id - (String)
      • :sender_fault - (Boolean)
      • :code - (String)
      • :message - (String)

#create_queue(options = {}) ⇒ Core::Response

Calls the CreateQueue API operation.

Parameters:

  • options (Hash) (defaults to: {})
    • :queue_name - required - (String) The name for the queue to be created.
    • :attributes - (Hash<<String,String>) A map of attributes with their corresponding values. The following lists the names, descriptions, and values of the special request parameters the CreateQueue action uses: DelaySeconds - The time in seconds that the delivery of all messages in the queue will be delayed. An integer from 0 to 900 (15 minutes). The default for this attribute is 0 (zero). MaximumMessageSize - The limit of how many bytes a message can contain before Amazon SQS rejects it. An integer from 1024 bytes (1 KiB) up to 262144 bytes (256 KiB). The default for this attribute is 262144 (256 KiB). MessageRetentionPeriod - The number of seconds Amazon SQS retains a message. Integer representing seconds, from 60 (1 minute) to 1209600 (14 days). The default for this attribute is 345600 (4 days). Policy - The queue's policy. A valid form-url-encoded policy. For more information about policy structure, see Basic Policy Structure in the Amazon SQS Developer Guide. For more information about form-url-encoding, see http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.2.1. ReceiveMessageWaitTimeSeconds - The time for which a ReceiveMessage call will wait for a message to arrive. An integer from 0 to 20 (seconds). The default for this attribute is 0. VisibilityTimeout - The visibility timeout for the queue. An integer from 0 to 43200 (12 hours). The default for this attribute is 30. For more information about visibility timeout, see Visibility Timeout in the Amazon SQS Developer Guide.

Returns:

  • (Core::Response)

    The #data method of the response object returns a hash with the following structure:

    • :queue_url - (String)

#delete_message(options = {}) ⇒ Core::Response

Calls the DeleteMessage API operation.

Parameters:

  • options (Hash) (defaults to: {})
    • :queue_url - required - (String) The URL of the Amazon SQS queue to take action on.
    • :receipt_handle - required - (String) The receipt handle associated with the message to delete.

Returns:

#delete_message_batch(options = {}) ⇒ Core::Response

Calls the DeleteMessageBatch API operation.

Parameters:

  • options (Hash) (defaults to: {})
    • :queue_url - required - (String) The URL of the Amazon SQS queue to take action on.
    • :entries - required - (Array<) A list of receipt handles for the messages to be deleted.
      • :id - required - (String) An identifier for this particular receipt handle. This is used to communicate the result. Note that the Ids of a batch request need to be unique within the request.
      • :receipt_handle - required - (String) A receipt handle.

Returns:

  • (Core::Response)

    The #data method of the response object returns a hash with the following structure:

    • :successful - (Array)
      • :id - (String)
    • :failed - (Array)
      • :id - (String)
      • :sender_fault - (Boolean)
      • :code - (String)
      • :message - (String)

#delete_queue(options = {}) ⇒ Core::Response

Calls the DeleteQueue API operation.

Parameters:

  • options (Hash) (defaults to: {})
    • :queue_url - required - (String) The URL of the Amazon SQS queue to take action on.

Returns:

#get_queue_attributes(options = {}) ⇒ Core::Response

Calls the GetQueueAttributes API operation.

Parameters:

  • options (Hash) (defaults to: {})
    • :queue_url - required - (String) The URL of the Amazon SQS queue to take action on.
    • :attribute_names - (Array<) A list of attributes to retrieve information for.

Returns:

  • (Core::Response)

    The #data method of the response object returns a hash with the following structure:

    • :attributes - (Hash<String,String>)

#get_queue_url(options = {}) ⇒ Core::Response

Calls the GetQueueUrl API operation.

Parameters:

  • options (Hash) (defaults to: {})
    • :queue_name - required - (String) The name of the queue whose URL must be fetched. Maximum 80 characters; alphanumeric characters, hyphens (-), and underscores (_) are allowed.
    • :queue_owner_aws_account_id - (String) The AWS account ID of the account that created the queue.

Returns:

  • (Core::Response)

    The #data method of the response object returns a hash with the following structure:

    • :queue_url - (String)

#list_dead_letter_source_queues(options = {}) ⇒ Core::Response

Calls the ListDeadLetterSourceQueues API operation.

Parameters:

  • options (Hash) (defaults to: {})
    • :queue_url - required - (String) The queue URL of a dead letter queue.

Returns:

  • (Core::Response)

    The #data method of the response object returns a hash with the following structure:

    • :queue_urls - (Array)

#list_queues(options = {}) ⇒ Core::Response

Calls the ListQueues API operation.

Parameters:

  • options (Hash) (defaults to: {})
    • :queue_name_prefix - (String) A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.

Returns:

  • (Core::Response)

    The #data method of the response object returns a hash with the following structure:

    • :queue_urls - (Array)

#receive_message(options = {}) ⇒ Core::Response

Calls the ReceiveMessage API operation.

Parameters:

  • options (Hash) (defaults to: {})
    • :queue_url - required - (String) The URL of the Amazon SQS queue to take action on.
    • :attribute_names - (Array<) A list of attributes that need to be returned along with each message. The following lists the names and descriptions of the attributes that can be returned: All - returns all values. ApproximateFirstReceiveTimestamp - returns the time when the message was first received (epoch time in milliseconds). ApproximateReceiveCount - returns the number of times a message has been received but not deleted. SenderId - returns the AWS account number (or the IP address, if anonymous access is allowed) of the sender. SentTimestamp - returns the time when the message was sent (epoch time in milliseconds).
    • :message_attribute_names - (Array<) The message attribute Name can contain the following characters: A-Z, a-z, 0-9, underscore(_), hyphen(-), and period (.). The message attribute name must not start or end with a period, and it should not have successive periods. The message attribute name is case sensitive and must be unique among all attribute names for the message. The message attribute name can be up to 256 characters long. Attribute names cannot start with "AWS." or "Amazon." because these prefixes are reserved for use by Amazon Web Services.
    • :max_number_of_messages - (Integer) The maximum number of messages to return. Amazon SQS never returns more messages than this value but may return fewer. Values can be from 1 to 10. Default is 1. All of the messages are not necessarily returned.
    • :visibility_timeout - (Integer) The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a ReceiveMessage request.
    • :wait_time_seconds - (Integer) The duration (in seconds) for which the call will wait for a message to arrive in the queue before returning. If a message is available, the call will return sooner than WaitTimeSeconds.

Returns:

  • (Core::Response)

    The #data method of the response object returns a hash with the following structure:

    • :messages - (Array)
      • :message_id - (String)
      • :receipt_handle - (String)
      • :md5_of_body - (String)
      • :body - (String)
      • :attributes - (Hash<String,String>)
      • :md5_of_message_attributes - (String)
      • :message_attributes - (Hash<String,Hash>)
        • :string_value - (String)
        • :binary_value - (String)
        • :string_list_values - (Array)
        • :binary_list_values - (Array)
        • :data_type - (String)

#remove_permission(options = {}) ⇒ Core::Response

Calls the RemovePermission API operation.

Parameters:

  • options (Hash) (defaults to: {})
    • :queue_url - required - (String) The URL of the Amazon SQS queue to take action on.
    • :label - required - (String) The identification of the permission to remove. This is the label added with the AddPermission action.

Returns:

#send_message(options = {}) ⇒ Core::Response

Calls the SendMessage API operation.

Parameters:

  • options (Hash) (defaults to: {})
    • :queue_url - required - (String) The URL of the Amazon SQS queue to take action on.
    • :message_body - required - (String) The message to send. String maximum 256 KB in size. For a list of allowed characters, see the preceding important note.
    • :delay_seconds - (Integer) The number of seconds (0 to 900 - 15 minutes) to delay a specific message. Messages with a positive DelaySeconds value become available for processing after the delay time is finished. If you don't specify a value, the default value for the queue applies.
    • :message_attributes - (Hash<<String,Hash>) Each message attribute consists of a Name, Type, and Value. For more information, see Message Attribute Items.
      • :string_value - (String) Strings are Unicode with UTF8 binary encoding. For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters.
      • :binary_value - (String) Binary type attributes can store any binary data, for example, compressed data, encrypted data, or images.
      • :string_list_values - (Array<) Not implemented. Reserved for future use.
      • :binary_list_values - (Array<) Not implemented. Reserved for future use.
      • :data_type - required - (String) Amazon SQS supports the following logical data types: String, Number, and Binary. In addition, you can append your own custom labels. For more information, see Message Attribute Data Types.

Returns:

  • (Core::Response)

    The #data method of the response object returns a hash with the following structure:

    • :md5_of_message_body - (String)
    • :md5_of_message_attributes - (String)
    • :message_id - (String)

#send_message_batch(options = {}) ⇒ Core::Response

Calls the SendMessageBatch API operation.

Parameters:

  • options (Hash) (defaults to: {})
    • :queue_url - required - (String) The URL of the Amazon SQS queue to take action on.
    • :entries - required - (Array<) A list of SendMessageBatchRequestEntry items.
      • :id - required - (String) An identifier for the message in this batch. This is used to communicate the result. Note that the Ids of a batch request need to be unique within the request.
      • :message_body - required - (String) Body of the message.
      • :delay_seconds - (Integer) The number of seconds for which the message has to be delayed.
      • :message_attributes - (Hash<<String,Hash>) Each message attribute consists of a Name, Type, and Value. For more information, see Message Attribute Items.
        • :string_value - (String) Strings are Unicode with UTF8 binary encoding. For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters.
        • :binary_value - (String) Binary type attributes can store any binary data, for example, compressed data, encrypted data, or images.
        • :string_list_values - (Array<) Not implemented. Reserved for future use.
        • :binary_list_values - (Array<) Not implemented. Reserved for future use.
        • :data_type - required - (String) Amazon SQS supports the following logical data types: String, Number, and Binary. In addition, you can append your own custom labels. For more information, see Message Attribute Data Types.

Returns:

  • (Core::Response)

    The #data method of the response object returns a hash with the following structure:

    • :successful - (Array)
      • :id - (String)
      • :message_id - (String)
      • :md5_of_message_body - (String)
      • :md5_of_message_attributes - (String)
    • :failed - (Array)
      • :id - (String)
      • :sender_fault - (Boolean)
      • :code - (String)
      • :message - (String)

#set_queue_attributes(options = {}) ⇒ Core::Response

Calls the SetQueueAttributes API operation.

Parameters:

  • options (Hash) (defaults to: {})
    • :queue_url - required - (String) The URL of the Amazon SQS queue to take action on.
    • :attributes - required - (Hash<<String,String>) A map of attributes to set. The following lists the names, descriptions, and values of the special request parameters the SetQueueAttributes action uses: DelaySeconds - The time in seconds that the delivery of all messages in the queue will be delayed. An integer from 0 to 900 (15 minutes). The default for this attribute is 0 (zero). MaximumMessageSize - The limit of how many bytes a message can contain before Amazon SQS rejects it. An integer from 1024 bytes (1 KiB) up to 262144 bytes (256 KiB). The default for this attribute is 262144 (256 KiB). MessageRetentionPeriod - The number of seconds Amazon SQS retains a message. Integer representing seconds, from 60 (1 minute) to 1209600 (14 days). The default for this attribute is 345600 (4 days). Policy - The queue's policy. A valid form-url-encoded policy. For more information about policy structure, see Basic Policy Structure in the Amazon SQS Developer Guide. For more information about form-url-encoding, see http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.2.1. ReceiveMessageWaitTimeSeconds - The time for which a ReceiveMessage call will wait for a message to arrive. An integer from 0 to 20 (seconds). The default for this attribute is 0. VisibilityTimeout - The visibility timeout for the queue. An integer from 0 to 43200 (12 hours). The default for this attribute is 30. For more information about visibility timeout, see Visibility Timeout in the Amazon SQS Developer Guide. RedrivePolicy - 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.

Returns: