Class: Eventr::Consumer

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

Instance Method Summary collapse

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

#mainObject



140
141
142
# File 'lib/eventr/actors.rb', line 140

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