Class: RightAws::Sqs
Overview
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
...
= queue2.receive
.visibility = 0
puts
...
queue2.clear(true)
queue2.('Ola-la!')
= queue2.pop
...
grantee1 = RightAws::Sqs::Grantee.create(queue2,'[email protected]')
grantee1.grant('FULLCONTROL')
grantee1.drop
...
grantee2 = queue.grantees('[email protected]')
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 }
Defined Under Namespace
Classes: Grantee, Message, Queue
Instance Attribute Summary collapse
-
#interface ⇒ Object
readonly
Returns the value of attribute interface.
Instance Method Summary collapse
-
#initialize(aws_access_key_id = nil, aws_secret_access_key = nil, params = {}) ⇒ Sqs
constructor
A new instance of Sqs.
-
#queue(queue_name, create = true, visibility = nil) ⇒ Object
Returns Queue instance by queue name.
-
#queues(prefix = nil) ⇒ Object
Retrieves a list of queues.
Constructor Details
#initialize(aws_access_key_id = nil, aws_secret_access_key = nil, params = {}) ⇒ Sqs
Returns a new instance of Sqs.
69 70 71 |
# File 'lib/sqs/right_sqs.rb', line 69 def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={}) @interface = SqsInterface.new(aws_access_key_id, aws_secret_access_key, params) end |
Instance Attribute Details
#interface ⇒ Object (readonly)
Returns the value of attribute interface.
67 68 69 |
# File 'lib/sqs/right_sqs.rb', line 67 def interface @interface end |
Instance Method Details
#queue(queue_name, create = true, visibility = nil) ⇒ Object
89 90 91 92 93 |
# File 'lib/sqs/right_sqs.rb', line 89 def queue(queue_name, create=true, visibility=nil) url = @interface.queue_url_by_name(queue_name) url = (create ? @interface.create_queue(queue_name, visibility) : nil) unless url url ? Queue.new(self, url) : nil end |