def retrieve(poll_time = 1)
      response = client.receive_message(url, {"WaitTimeSeconds" => poll_time, "MaxNumberOfMessages" => 1})
      raise QueueNotFound.new(self, "not found at #{url}") if response.http_response.status == 404

      response.doc.xpath("//Message").map do |element|
        attributes = Hash[*element.xpath("Attribute").map do |attr_element|
          [attr_element.xpath("Name").text, attr_element.xpath("Value").text]
        end.flatten]

        Message.new(self, element.xpath("MessageId").text,
                    element.xpath("ReceiptHandle").text,
                    element.xpath("Body").text,
                    attributes
                   )
      end.first
    end
def retrieve(poll_time = 1)
      response = client.receive_message(url, {"WaitTimeSeconds" => poll_time, "MaxNumberOfMessages" => 1})
      raise QueueNotFound.new(self, "not found at #{url}") if response.http_response.status == 404

      response.doc.xpath("//Message").map do |element|
        attributes = Hash[*element.xpath("Attribute").map do |attr_element|
          [attr_element.xpath("Name").text, attr_element.xpath("Value").text]
        end.flatten]

        Message.new(self, element.xpath("MessageId").text,
                    element.xpath("ReceiptHandle").text,
                    element.xpath("Body").text,
                    attributes
                   )
      end.first
    end
Retrieve a message from the queue. Returns nil if no message is waiting
 in the given poll time. Otherwise it returns a Message.

 @param [Fixnum] poll_time
 @return [Message,nil]
 @raise [AwsActionError]