Class: SqsAccelerator::SqsProxy
- Inherits:
-
Object
- Object
- SqsAccelerator::SqsProxy
- Defined in:
- lib/sqs_proxy.rb
Overview
This class will be removed. It’s just for the operations that haven’t been switched to use the evented http client yet.
Instance Method Summary collapse
- #create_queue(queue_name, visibility_timeout) ⇒ Object
- #get_queue_info(queue_name) ⇒ Object
-
#initialize(aws_access_key_id, aws_secret_access_key, options = {}) ⇒ SqsProxy
constructor
A new instance of SqsProxy.
Constructor Details
#initialize(aws_access_key_id, aws_secret_access_key, options = {}) ⇒ SqsProxy
Returns a new instance of SqsProxy.
8 9 10 11 12 |
# File 'lib/sqs_proxy.rb', line 8 def initialize(aws_access_key_id, aws_secret_access_key, = {}) = {:multi_thread => true}.merge() @logger = [:logger] @sqs = RightAws::SqsGen2.new(aws_access_key_id, aws_secret_access_key, ) end |
Instance Method Details
#create_queue(queue_name, visibility_timeout) ⇒ Object
14 15 16 |
# File 'lib/sqs_proxy.rb', line 14 def create_queue(queue_name, visibility_timeout) RightAws::SqsGen2::Queue.create(@sqs, queue_name, true, visibility_timeout) end |
#get_queue_info(queue_name) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/sqs_proxy.rb', line 18 def get_queue_info(queue_name) # TODO do something smart if the queue doesn't exist queue = @sqs.queue(queue_name, false) queue_info = { :num_messages => queue.size, :visibility_timeout => queue.visibility } return queue_info end |