Class: SqsAccelerator::SqsProxy

Inherits:
Object
  • Object
show all
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

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, options = {})
  options = {:multi_thread => true}.merge(options)
  @logger = options[:logger]
  @sqs = RightAws::SqsGen2.new(aws_access_key_id, aws_secret_access_key, options)
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