Class: Fluent::RelpInput

Inherits:
Input
  • Object
show all
Defined in:
lib/fluent/plugin/in_relp.rb

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



15
16
17
# File 'lib/fluent/plugin/in_relp.rb', line 15

def configure(conf)
    super
end

#on_message(msg) ⇒ Object



38
39
40
41
42
43
44
45
# File 'lib/fluent/plugin/in_relp.rb', line 38

def on_message(msg)
	  time = Engine.now
	  record = {"message"=> msg}
	  router.emit(@tag, time, record)
  rescue => e
    log.error msg.dump, error: e, error_class: e.class
    log.error_backtrace
end

#runObject



31
32
33
34
35
36
# File 'lib/fluent/plugin/in_relp.rb', line 31

def run
    @server.run()
  rescue => e
    log.error "unexpected error", error: e, error_class: e.class
    log.error_backtrace
end

#shutdownObject



25
26
27
28
29
# File 'lib/fluent/plugin/in_relp.rb', line 25

def shutdown
	super
	@server.server_shutdown
    @thread.join
end

#startObject



19
20
21
22
23
# File 'lib/fluent/plugin/in_relp.rb', line 19

def start
	super
	@server = Relp::RelpServer.new(@bind, @port, log, method(:on_message))
    @thread = Thread.new(&method(:run))
end