Class: ReliableMsg::Message
- Inherits:
-
Object
- Object
- ReliableMsg::Message
- 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
-
#headers ⇒ Object
Returns the message headers.
-
#id ⇒ Object
Returns the message identifier.
-
#initialize(id, headers, object) ⇒ Message
constructor
:nodoc:.
-
#object ⇒ Object
Returns the message object.
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
#headers ⇒ Object
Returns the message headers.
:call-seq:
msg.headers -> hash
492 493 494 |
# File 'lib/reliable-msg/queue.rb', line 492 def headers @headers end |
#id ⇒ Object
Returns the message identifier.
:call-seq:
msg.id -> id
474 475 476 |
# File 'lib/reliable-msg/queue.rb', line 474 def id @id end |
#object ⇒ Object
Returns the message object.
:call-seq:
msg.object -> obj
483 484 485 |
# File 'lib/reliable-msg/queue.rb', line 483 def object @object end |