Class: Eventr::Consumer
- Inherits:
-
SupervisedObject
- Object
- SupervisedObject
- Eventr::Consumer
- Defined in:
- lib/eventr/actors.rb
Instance Method Summary collapse
-
#initialize(publisher, &block) ⇒ Consumer
constructor
A new instance of Consumer.
- #main ⇒ Object
Methods inherited from SupervisedObject
#application, #on_exception, #on_exception=, #sleep_time_from_backoff, #start, #start_application_thread, #start_supervisor_thread, #stop, #supervisor, #threads
Constructor Details
#initialize(publisher, &block) ⇒ Consumer
Returns a new instance of Consumer.
135 136 137 138 |
# File 'lib/eventr/actors.rb', line 135 def initialize(publisher, &block) @publisher = publisher @block = block end |
Instance Method Details
#main ⇒ Object
140 141 142 |
# File 'lib/eventr/actors.rb', line 140 def main loop { block.call(publisher.pop) } end |