lib/sqs/right_sqs_gen2_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_message('https://queue.amazonaws.com/ZZ7XXXYYYBINS/my_awesome_queue',10, 5) #=>
#    [{"ReceiptHandle"=>"Euvo62...kw==", "MD5OfBody"=>"16af2171b5b83cfa35ce254966ba81e3", 
#      "Body"=>"Goodbyte World!", "MessageId"=>"MUM4WlAyR...pYOTA="}, ..., {}]
#
# Normally this call returns fewer messages than the maximum specified,
# even if they are available.
#
Retrieves a list of messages from queue.

Normally this call returns fewer messages than the maximum specified,
even if they are available.
Retrieves a list of messages from queue . Normally this call returns fewer messages than the maximum specified even if they are available .
def receive_message(queue_url, max_number_of_messages=1, visibility_timeout=nil, attributes=nil)
      return [] if max_number_of_messages == 0
      params = {}
      params.merge!(amazonize_list('AttributeName', Array(attributes))) unless attributes.right_blank?
      params.merge!('MaxNumberOfMessages' => max_number_of_messages,
                    'VisibilityTimeout'   => visibility_timeout,
                    :queue_url            => queue_url )
      req_hash = generate_post_request('ReceiveMessage', params)
      request_info(req_hash, SqsReceiveMessageParser.new(:logger => @logger))
    rescue
      on_exception
    end
def receive_message ( queue_url , max_number_of_messages = 1 , visibility_timeout = nil , attributes = nil ) return [ ] if max_number_of_messages == 0 params = { } params . merge! ( amazonize_list ( 'AttributeName' , Array ( attributes ) ) ) unless attributes . right_blank? params . merge! ( 'MaxNumberOfMessages' => max_number_of_messages , 'VisibilityTimeout' => visibility_timeout , :queue_url => queue_url ) req_hash = generate_post_request ( 'ReceiveMessage' , params ) request_info ( req_hash , SqsReceiveMessageParser . 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>
max_number_of_messages
<not_specific>
visibility_timeout
<not_specific>
attributes
<not_specific>