Class: TorqueBox::Messaging::MessageProcessor
- Inherits:
-
Object
- Object
- TorqueBox::Messaging::MessageProcessor
- Includes:
- ProcessorMiddleware::DefaultMiddleware
- Defined in:
- lib/torquebox/messaging/message_processor.rb
Direct Known Subclasses
BackgroundableProcessor, Torquebox::Messaging::EchoProcessor
Instance Attribute Summary collapse
-
#message ⇒ Object
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize ⇒ MessageProcessor
constructor
A new instance of MessageProcessor.
- #on_error(error) ⇒ Object
- #on_message(body) ⇒ Object
- #process!(message) ⇒ Object
Methods included from ProcessorMiddleware::DefaultMiddleware
Constructor Details
#initialize ⇒ MessageProcessor
Returns a new instance of MessageProcessor.
27 28 29 |
# File 'lib/torquebox/messaging/message_processor.rb', line 27 def initialize @message = nil end |
Instance Attribute Details
#message ⇒ Object
Returns the value of attribute message.
25 26 27 |
# File 'lib/torquebox/messaging/message_processor.rb', line 25 def @message end |
Instance Method Details
#on_error(error) ⇒ Object
35 36 37 |
# File 'lib/torquebox/messaging/message_processor.rb', line 35 def on_error(error) raise error end |
#on_message(body) ⇒ Object
31 32 33 |
# File 'lib/torquebox/messaging/message_processor.rb', line 31 def (body) throw "Your subclass must implement on_message(body)" end |
#process!(message) ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/torquebox/messaging/message_processor.rb', line 39 def process!() @message = begin ( .decode ) rescue Exception => e on_error( e ) end end |