Module: FFWD::Plugin::Riemann::Connection

Included in:
InputTCP, InputUDP
Defined in:
lib/ffwd/plugin/riemann/connection.rb

Defined Under Namespace

Modules: Serializer

Instance Method Summary collapse

Instance Method Details

#initialize(bind, core, config) ⇒ Object



32
33
34
35
36
# File 'lib/ffwd/plugin/riemann/connection.rb', line 32

def initialize bind, core, config
  @bind = bind
  @core = core
  @config = config
end

#receive_object(m) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# 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

#serializerObject



28
29
30
# File 'lib/ffwd/plugin/riemann/connection.rb', line 28

def serializer
  FFWD::Plugin::Riemann::Connection::Serializer
end