Class RightAws::Sqs
In: lib/sqs/right_sqs.rb
Parent: Object
RuntimeError AwsError AwsNoChange RightAWSParser RightErrorResponseParser RightHttp2xxParser AcfInterface SqsInterface SqsGen2Interface S3Interface Ec2 SdbInterface RightAwsBase ActiveSdbConnect ActiveSdb SqsGen2 S3 S3Generator Sqs RightDummyParser AWSErrorHandler AwsBenchmarkingBlock AwsUtils RightSaxParserCallback lib/sqs/right_sqs_interface.rb lib/sqs/right_sqs_gen2.rb lib/s3/right_s3.rb lib/acf/right_acf_interface.rb lib/sqs/right_sqs_gen2_interface.rb lib/sqs/right_sqs.rb lib/sdb/right_sdb_interface.rb lib/sdb/active_sdb.rb lib/ec2/right_ec2.rb lib/s3/right_s3_interface.rb lib/awsbase/right_awsbase.rb RightAwsBaseInterface VERSION RightAws dot/m_13_0.png

RightAws::Sqs — RightScale‘s Amazon SQS interface

The RightAws::Sqs class provides a complete interface to Amazon‘s Simple Queue Service. For explanations of the semantics of each call, please refer to Amazon‘s documentation at developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=31

Error handling: all operations raise an RightAws::AwsError in case of problems. Note that transient errors are automatically retried.

 sqs    = RightAws::Sqs.new(aws_access_key_id, aws_secret_access_key)
 queue1 = sqs.queue('my_awesome_queue')
  ...
 queue2 = RightAws::Sqs::Queue.create(sqs, 'my_cool_queue', true)
 puts queue2.size
  ...
 message1 = queue2.receive
 message1.visibility = 0
 puts message1
  ...
 queue2.clear(true)
 queue2.send_message('Ola-la!')
 message2 = queue2.pop
  ...
 grantee1 = RightAws::Sqs::Grantee.create(queue2,'one_cool_guy@email.address')
 grantee1.grant('FULLCONTROL')
 grantee1.drop
  ...
 grantee2 = queue.grantees('another_cool_guy@email.address')
 grantee2.revoke('SENDMESSAGE')

Params is a hash:

   {:server       => 'queue.amazonaws.com' # Amazon service host: 'queue.amazonaws.com' (default)
    :port         => 443                   # Amazon service port: 80 or 443 (default)
    :multi_thread => true|false            # Multi-threaded (connection per each thread): true or false (default)
    :signature_version => '0'              # The signature version : '0' or '1'(default)
    :logger       => Logger Object}        # Logger instance: logs to STDOUT if omitted }

Methods

new   queue   queues  

Classes and Modules

Class RightAws::Sqs::Grantee
Class RightAws::Sqs::Message
Class RightAws::Sqs::Queue

Attributes

interface  [R] 

Public Class methods

[Source]

    # File lib/sqs/right_sqs.rb, line 69
69:     def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})
70:       @interface = SqsInterface.new(aws_access_key_id, aws_secret_access_key, params)
71:     end

Public Instance methods

Returns Queue instance by queue name. If the queue does not exist at Amazon SQS and create is true, the method creates it.

 RightAws::Sqs.queue('my_awesome_queue') #=> #<RightAws::Sqs::Queue:0xb7b626e4 ... >

[Source]

    # File lib/sqs/right_sqs.rb, line 89
89:     def queue(queue_name, create=true, visibility=nil)
90:       url = @interface.queue_url_by_name(queue_name)
91:       url = (create ? @interface.create_queue(queue_name, visibility) : nil) unless url
92:       url ? Queue.new(self, url) : nil
93:     end

Retrieves a list of queues. Returns an array of Queue instances.

 RightAws::Sqs.queues #=> array of queues

[Source]

    # File lib/sqs/right_sqs.rb, line 78
78:     def queues(prefix=nil)
79:       @interface.list_queues(prefix).map do |url|
80:         Queue.new(self, url)
81:       end
82:     end

[Validate]