Class: QProcessor::Message
- Inherits:
-
Object
- Object
- QProcessor::Message
- Defined in:
- lib/qprocessor/message.rb
Overview
This is a class representing a message or job pulled from a queue with the intention of this class providing a unified interface around different library classes.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#body ⇒ Object
Retrieves the content of the message/job as a String.
-
#dispose ⇒ Object
This method should do whatever is necessary to clean up a message/job such that the underlying queuing mechanism will no longer deliver it.
-
#id ⇒ Object
Fetches a unique identifer for the message/job.
-
#initialize(source) ⇒ Message
constructor
A new instance of Message.
-
#release ⇒ Object
This method should do whatever is necessary to return a message/job to the underlying queuing mechanism such that it becomes available again for delivery.
Constructor Details
#initialize(source) ⇒ Message
Returns a new instance of Message.
6 7 8 |
# File 'lib/qprocessor/message.rb', line 6 def initialize(source) @source = source end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
9 10 11 |
# File 'lib/qprocessor/message.rb', line 9 def source @source end |
Instance Method Details
#body ⇒ Object
Retrieves the content of the message/job as a String.
12 13 14 |
# File 'lib/qprocessor/message.rb', line 12 def body @source.body end |
#dispose ⇒ Object
This method should do whatever is necessary to clean up a message/job such that the underlying queuing mechanism will no longer deliver it. This is a ‘do nothing’ implementation that can be overridden by derived classes to provide for this functionality.
20 21 |
# File 'lib/qprocessor/message.rb', line 20 def dispose end |
#id ⇒ Object
Fetches a unique identifer for the message/job. This default implementation raises an exception. Derived classes can override this to provide the required functionality.
26 27 28 |
# File 'lib/qprocessor/message.rb', line 26 def id raise "The #{self.class.name} class does not override the #id() method." end |
#release ⇒ Object
This method should do whatever is necessary to return a message/job to the underlying queuing mechanism such that it becomes available again for delivery. This is a ‘do nothing’ implementation that can be overridden by derived classes to provide for this functionality.
34 35 |
# File 'lib/qprocessor/message.rb', line 34 def release end |