lib/sqs/right_sqs_interface.rb
# Retrieves a list of messages from queue. Returns an array of hashes in format: <tt>{:id=>'message_id', body=>'message_body'}</tt>
#
#   sqs.receive_messages('http://queue.amazonaws.com/ZZ7XXXYYYBINS/my_awesome_queue',10, 5) #=>
#    [{:id=>"12345678904GEZX9746N|0N9ED344VK5Z3SV1DTM0|1RVYH4X3TJ0987654321", :body=>"message_1"}, ..., {}]
#
# P.S. Usually returns fewer messages than requested even if they are available.
#
Retrieves a list of messages from queue.


Retrieves a list of messages from queue .
def receive_messages(queue_url, number_of_messages=1, visibility_timeout=nil)
      return [] if number_of_messages == 0
      req_hash = generate_rest_request('GET',
                                       'NumberOfMessages'  => number_of_messages,
                                       'VisibilityTimeout' => visibility_timeout,
                                       :queue_url          => "#{queue_url}/front" )
      request_info(req_hash, SqsReceiveMessagesParser.new(:logger => @logger))
    rescue
      on_exception
    end
def receive_messages ( queue_url , number_of_messages = 1 , visibility_timeout = nil ) return [ ] if number_of_messages == 0 req_hash = generate_rest_request ( 'GET' , 'NumberOfMessages' => number_of_messages , 'VisibilityTimeout' => visibility_timeout , :queue_url => "#{queue_url}/front" ) request_info ( req_hash , SqsReceiveMessagesParser . new ( :logger => @logger ) ) rescue on_exception end
Retrieves a list of messages from queue.
Retrieves a list of messages from queue .
queue_url
<not_specific>
number_of_messages
<not_specific>
visibility_timeout
<not_specific>