Class: Lapine::Consumer::Dispatcher
- Inherits:
-
Object
- Object
- Lapine::Consumer::Dispatcher
- Defined in:
- lib/lapine/consumer/dispatcher.rb
Defined Under Namespace
Classes: DefaultErrorHandler
Instance Attribute Summary collapse
-
#delegate_class ⇒ Object
readonly
Returns the value of attribute delegate_class.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
Class Method Summary collapse
Instance Method Summary collapse
- #dispatch ⇒ Object
-
#initialize(delegate_class, message) ⇒ Dispatcher
constructor
A new instance of Dispatcher.
Constructor Details
#initialize(delegate_class, message) ⇒ Dispatcher
Returns a new instance of Dispatcher.
23 24 25 26 27 |
# File 'lib/lapine/consumer/dispatcher.rb', line 23 def initialize(delegate_class, ) @delegate_class = delegate_class = @payload = .decoded_payload end |
Instance Attribute Details
#delegate_class ⇒ Object (readonly)
Returns the value of attribute delegate_class.
13 14 15 |
# File 'lib/lapine/consumer/dispatcher.rb', line 13 def delegate_class @delegate_class end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
13 14 15 |
# File 'lib/lapine/consumer/dispatcher.rb', line 13 def end |
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
13 14 15 |
# File 'lib/lapine/consumer/dispatcher.rb', line 13 def payload @payload end |
Class Method Details
.error_handler ⇒ Object
19 20 21 |
# File 'lib/lapine/consumer/dispatcher.rb', line 19 def self.error_handler @error_handler || DefaultErrorHandler.new end |
.error_handler=(handler) ⇒ Object
15 16 17 |
# File 'lib/lapine/consumer/dispatcher.rb', line 15 def self.error_handler=(handler) @error_handler = handler end |
Instance Method Details
#dispatch ⇒ Object
29 30 31 32 33 |
# File 'lib/lapine/consumer/dispatcher.rb', line 29 def dispatch Lapine::DTrace.fire!(:dispatch_enter, delegate_class.name, .payload) with_timed_logging(payload) { do_dispatch(payload) } Lapine::DTrace.fire!(:dispatch_return, delegate_class.name, .payload) end |