Class: Ungulate::SqsMessageQueue

Inherits:
Object
  • Object
show all
Defined in:
lib/ungulate/sqs_message_queue.rb

Instance Method Summary collapse

Constructor Details

#initialize(name, options) ⇒ SqsMessageQueue

Returns a new instance of SqsMessageQueue.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ungulate/sqs_message_queue.rb', line 5

def initialize(name, options)
  if name.blank?
    raise Ungulate::MissingConfiguration,
      "queue_name must be set in config"
  end

  sqs = RightAws::SqsGen2.new(
    options[:access_key_id], options[:secret_access_key],
    :server => options[:server]
  )
  @queue = sqs.queue name
end

Instance Method Details

#clearObject



22
23
24
# File 'lib/ungulate/sqs_message_queue.rb', line 22

def clear
  @queue.clear
end

#nameObject



18
19
20
# File 'lib/ungulate/sqs_message_queue.rb', line 18

def name
  @queue.name
end

#push(message) ⇒ Object



26
27
28
# File 'lib/ungulate/sqs_message_queue.rb', line 26

def push(message)
  @queue.push(message)
end

#receiveObject



30
31
32
# File 'lib/ungulate/sqs_message_queue.rb', line 30

def receive
  @queue.receive
end

#sizeObject



34
35
36
# File 'lib/ungulate/sqs_message_queue.rb', line 34

def size
  @queue.size
end