class Remon::EventProcessor

Attributes

queue[R]

Public Class Methods

new(pr) click to toggle source
# File lib/remon/event_processor.rb, line 9
def initialize(pr)
  @proc = pr
  @queue = Queue.new
end

Public Instance Methods

process_event() click to toggle source
# File lib/remon/event_processor.rb, line 21
def process_event
  event = @queue.pop
  @proc.call event
rescue => e
  logger.warn "warn error #{e.message}"
end
start() click to toggle source
# File lib/remon/event_processor.rb, line 14
def start
  @thread ||= Thread.new do
    logger.debug { "starting event processor" }
    loop { process_event }
  end
end
stop() click to toggle source
# File lib/remon/event_processor.rb, line 28
def stop
  Thread.kill @thread if @thread
end