class Fluent::DaioikachanInput
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/in_daioikachan.rb, line 5 def initialize require 'puma' require 'uri' require 'rack' super end
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/in_daioikachan.rb, line 18 def configure(conf) super end
on_request(env)
click to toggle source
# File lib/fluent/plugin/in_daioikachan.rb, line 49 def on_request(env) log.debug { "in_daioikachan: #{env.to_s}" } @app.run(env) end
run()
click to toggle source
# File lib/fluent/plugin/in_daioikachan.rb, line 42 def run @server.run(false) rescue => e log.error "unexpected error", :error => e.to_s log.error_backtrace e.backtrace end
setup_http()
click to toggle source
# File lib/fluent/plugin/in_daioikachan.rb, line 54 def setup_http log.info "listening http on #{@bind}:#{@port}" opts = [@bind, @port, true] opts << @backlog if @backlog @server.add_tcp_listener(*opts) end
shutdown()
click to toggle source
# File lib/fluent/plugin/in_daioikachan.rb, line 37 def shutdown @server.stop(true) @thread.join end
start()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/in_daioikachan.rb, line 22 def start super # Refer puma's Runner and Rack handler for puma server setup @server = ::Puma::Server.new(method(:on_request)) @server.min_threads = @min_threads @server.max_threads = @max_threads @server.leak_stack_on_error = false setup_http @app = App.new(self) @thread = Thread.new(&method(:run)) end