Class: Eventr::Consumer

Inherits:
SupervisedObject show all
Defined in:
lib/eventr/actors.rb

Instance Attribute Summary

Attributes inherited from SupervisedObject

#on_exception

Instance Method Summary collapse

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

#mainObject



157
158
159
# File 'lib/eventr/actors.rb', line 157

def main
  loop { block.call(publisher.pop) }
end