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.



23
24
25
26
27
# File 'lib/fluent/plugin/in_http_heartbeat.rb', line 23

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

Instance Method Details

#runObject



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

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

#shutdownObject



57
58
59
60
61
# File 'lib/fluent/plugin/in_http_heartbeat.rb', line 57

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

#startObject



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

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