Class: Fluent::HttpHeartbeatInput

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

Defined Under Namespace

Classes: HeartbeatConnection

Instance Method Summary collapse

Constructor Details

#initializeHttpHeartbeatInput

Returns a new instance of HttpHeartbeatInput.



21
22
23
24
25
# File 'lib/fluent/plugin/in_http_heartbeat.rb', line 21

def initialize
  super
  require 'cool.io'
  require 'fluent/input'
end

Instance Method Details

#runObject



61
62
63
64
65
66
# File 'lib/fluent/plugin/in_http_heartbeat.rb', line 61

def run
  @loop.run()
rescue
  log.error "unexpected error", error: $!.to_s
  log.error_backtrace
end

#shutdownObject



55
56
57
58
59
# File 'lib/fluent/plugin/in_http_heartbeat.rb', line 55

def shutdown
  @loop.stop
  @server.close
  @thread.join
end

#startObject



44
45
46
47
48
49
50
51
52
53
# File 'lib/fluent/plugin/in_http_heartbeat.rb', line 44

def start
  super

  log.debug "listening http on #{@bind}:#{@port}"
  @server = Cool.io::TCPServer.new(@bind, @port, HeartbeatConnection)
  @loop = Coolio::Loop.new
  @loop.attach(@server)
  
  @thread = Thread.new(&method(:run))
end