Class: Requeus::Adapter::SQS

Inherits:
Object
  • Object
show all
Defined in:
lib/requeus/adapter/sqs.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ SQS

Returns a new instance of SQS.



4
5
6
# File 'lib/requeus/adapter/sqs.rb', line 4

def initialize options = {}
  @options = options
end

Instance Method Details

#confirm(queue, handle) ⇒ Object



18
19
20
# File 'lib/requeus/adapter/sqs.rb', line 18

def confirm queue, handle
  connection.interface.delete_message(connection.interface.queue_url_by_name(queue), handle)
end

#get(queue, limit = 1) ⇒ Object



12
13
14
15
16
# File 'lib/requeus/adapter/sqs.rb', line 12

def get queue, limit = 1
  get_queue(queue).receive_messages(limit).map do |message|
    [message.receipt_handle, message.body]
  end
end

#put(queue, request) ⇒ Object



8
9
10
# File 'lib/requeus/adapter/sqs.rb', line 8

def put queue, request
  get_queue(queue).send_message(request)
end