Class: ActiveMessaging::Adapters::Sqs::Message

Inherits:
BaseMessage
  • Object
show all
Defined in:
lib/activemessaging/adapters/sqs.rb

Overview

based on stomp message, has pointer to the SQSResponseObject

Instance Attribute Summary collapse

Attributes inherited from BaseMessage

#body, #destination, #headers, #id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseMessage

#dup, #matches_subscription?

Constructor Details

#initialize(body, headers, id, md5_of_body, receipt_handle, attributes, response, queue) ⇒ Message

Returns a new instance of Message.



479
480
481
482
# File 'lib/activemessaging/adapters/sqs.rb', line 479

def initialize body, headers, id, md5_of_body, receipt_handle, attributes, response, queue
  super(body, id, headers, queue.name)
  @md5_of_body, @receipt_handle, @response, @queue =  md5_of_body, receipt_handle, response, queue
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



462
463
464
# File 'lib/activemessaging/adapters/sqs.rb', line 462

def attributes
  @attributes
end

#md5_of_bodyObject

Returns the value of attribute md5_of_body.



462
463
464
# File 'lib/activemessaging/adapters/sqs.rb', line 462

def md5_of_body
  @md5_of_body
end

#queueObject

Returns the value of attribute queue.



462
463
464
# File 'lib/activemessaging/adapters/sqs.rb', line 462

def queue
  @queue
end

#receipt_handleObject

Returns the value of attribute receipt_handle.



462
463
464
# File 'lib/activemessaging/adapters/sqs.rb', line 462

def receipt_handle
  @receipt_handle
end

#request_idObject

Returns the value of attribute request_id.



462
463
464
# File 'lib/activemessaging/adapters/sqs.rb', line 462

def request_id
  @request_id
end

#responseObject

Returns the value of attribute response.



462
463
464
# File 'lib/activemessaging/adapters/sqs.rb', line 462

def response
  @response
end

Class Method Details

.from_element(e, response, queue) ⇒ Object



464
465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/activemessaging/adapters/sqs.rb', line 464

def self.from_element(e, response, queue)
  attributes = {}
  e.elements.each('Attribute') { |n| attributes[n.elements['Name'].text] = n.elements['Value'].text }

  Message.new(
    e.elements['Body'].text,
    response.headers,
    e.elements['MessageId'].text,
    e.elements['MD5OfBody'].text,
    e.elements['ReceiptHandle'].text,
    attributes,
    response,
    queue)
end

Instance Method Details

#to_sObject



484
485
486
# File 'lib/activemessaging/adapters/sqs.rb', line 484

def to_s
  "<AmazonSQS::Message id='#{id}' body='#{body}' headers='#{headers.inspect}' attributes='#{attributes.inspect}' response='#{response}'>"
end