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.



467
468
469
470
# File 'lib/activemessaging/adapters/sqs.rb', line 467

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.



450
451
452
# File 'lib/activemessaging/adapters/sqs.rb', line 450

def attributes
  @attributes
end

#md5_of_bodyObject

Returns the value of attribute md5_of_body.



450
451
452
# File 'lib/activemessaging/adapters/sqs.rb', line 450

def md5_of_body
  @md5_of_body
end

#queueObject

Returns the value of attribute queue.



450
451
452
# File 'lib/activemessaging/adapters/sqs.rb', line 450

def queue
  @queue
end

#receipt_handleObject

Returns the value of attribute receipt_handle.



450
451
452
# File 'lib/activemessaging/adapters/sqs.rb', line 450

def receipt_handle
  @receipt_handle
end

#request_idObject

Returns the value of attribute request_id.



450
451
452
# File 'lib/activemessaging/adapters/sqs.rb', line 450

def request_id
  @request_id
end

#responseObject

Returns the value of attribute response.



450
451
452
# File 'lib/activemessaging/adapters/sqs.rb', line 450

def response
  @response
end

Class Method Details

.from_element(e, response, queue) ⇒ Object



452
453
454
455
456
457
458
459
460
461
462
463
464
465
# File 'lib/activemessaging/adapters/sqs.rb', line 452

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



472
473
474
# File 'lib/activemessaging/adapters/sqs.rb', line 472

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