Class: Eventr::Consumer
- Inherits:
-
SupervisedObject
- Object
- SupervisedObject
- Eventr::Consumer
- Defined in:
- lib/eventr/actors.rb
Instance Attribute Summary
Attributes inherited from SupervisedObject
Instance Method Summary collapse
-
#initialize(publisher, &block) ⇒ Consumer
constructor
A new instance of Consumer.
- #main ⇒ Object
Methods inherited from SupervisedObject
#application, #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.
152 153 154 155 |
# File 'lib/eventr/actors.rb', line 152 def initialize(publisher, &block) @publisher = publisher @block = block end |
Instance Method Details
#main ⇒ Object
157 158 159 |
# File 'lib/eventr/actors.rb', line 157 def main loop { block.call(publisher.pop) } end |