class Rutema::Reporters::EventReporter
Public Class Methods
new(configuration,dispatcher)
click to toggle source
# File lib/rutema/core/reporter.rb, line 18 def initialize configuration,dispatcher @configuration=configuration @queue=dispatcher.subscribe(self.object_id) end
Public Instance Methods
exit()
click to toggle source
# File lib/rutema/core/reporter.rb, line 43 def exit puts "Exiting #{self.class}" if $DEBUG if @thread puts "Reporter died with #{@queue.size} messages in the queue" unless @thread.alive? while @queue.size>0 && @thread.alive? do sleep 0.1 end Thread.kill(@thread) end end
run!()
click to toggle source
# File lib/rutema/core/reporter.rb, line 23 def run! @thread=Thread.new do while true do if @queue.size>0 data=@queue.pop begin update(data) if data rescue puts "#{self.class} failed with #{$!.message}" raise end end sleep 0.1 end end end
update(data)
click to toggle source
# File lib/rutema/core/reporter.rb, line 40 def update data end