module FFWD::Plugin::Riemann::Connection

Public Class Methods

new(bind, core, config) click to toggle source
# File lib/ffwd/plugin/riemann/connection.rb, line 32
def initialize bind, core, config
  @bind = bind
  @core = core
  @config = config
end

Public Instance Methods

receive_object(m) click to toggle source
# File lib/ffwd/plugin/riemann/connection.rb, line 38
def receive_object(m)
  # handle no events in object.
  if m.events.nil?
    send_ok
    return
  end

  unless m.events.nil? or m.events.empty?
    events = m.events.map{|e| read_event(e)}
    events.each{|e| @core.input.event e}
  end

  @bind.increment :received_events, m.events.size
  send_ok
rescue => e
  @bind.increment :failed_events, m.events.size
  @bind.log.error "Failed to receive object", e
  send_error e
end
serializer() click to toggle source
# File lib/ffwd/plugin/riemann/connection.rb, line 28
def serializer
  FFWD::Plugin::Riemann::Connection::Serializer
end

Protected Instance Methods

send_error(e) click to toggle source
# File lib/ffwd/plugin/riemann/connection.rb, line 61
def send_error(e); end
send_ok() click to toggle source
# File lib/ffwd/plugin/riemann/connection.rb, line 60
def send_ok; end