Class: ReliableMsg::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/reliable-msg/queue.rb

Overview

Retrieved Message

Returned from Queue.get holding the last message retrieved from the queue and providing access to the message identifier, headers and object.

For example:

while queue.get do |msg|
  print "Message #{msg.id}"
  print "Headers: #{msg.headers.inspect}"
  print msg.object
  true
end

Instance Method Summary collapse

Constructor Details

#initialize(id, headers, object) ⇒ Message

:nodoc:



465
466
467
# File 'lib/reliable-msg/queue.rb', line 465

def initialize id, headers, object # :nodoc:

    @id, @object, @headers = id, object, headers
end

Instance Method Details

#headersObject

Returns the message headers.

:call-seq:

msg.headers -> hash


492
493
494
# File 'lib/reliable-msg/queue.rb', line 492

def headers
    @headers
end

#idObject

Returns the message identifier.

:call-seq:

msg.id -> id


474
475
476
# File 'lib/reliable-msg/queue.rb', line 474

def id
    @id
end

#objectObject

Returns the message object.

:call-seq:

msg.object -> obj


483
484
485
# File 'lib/reliable-msg/queue.rb', line 483

def object
    @object
end