Class: Fluent::SocketUtil::BaseInput

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

Direct Known Subclasses

TcpInput, UdpInput

Constant Summary

Constants included from Configurable

Configurable::CONFIG_TYPE_REGISTRY

Instance Attribute Summary

Attributes inherited from Input

#router

Attributes included from PluginLoggerMixin

#log

Instance Method Summary collapse

Methods included from PluginLoggerMixin

included

Methods included from PluginId

#plugin_id

Methods included from Configurable

#config, included, lookup_type, register_type

Constructor Details

#initializeBaseInput

Returns a new instance of BaseInput.



94
95
96
97
# File 'lib/fluent/plugin/socket_util.rb', line 94

def initialize
  super
  require 'fluent/parser'
end

Instance Method Details

#configure(conf) ⇒ Object



111
112
113
114
115
116
# File 'lib/fluent/plugin/socket_util.rb', line 111

def configure(conf)
  super

  @parser = Plugin.new_parser(@format)
  @parser.configure(conf)
end

#runObject



132
133
134
135
136
137
# File 'lib/fluent/plugin/socket_util.rb', line 132

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

#shutdownObject



125
126
127
128
129
130
# File 'lib/fluent/plugin/socket_util.rb', line 125

def shutdown
  @loop.watchers.each { |w| w.detach }
  @loop.stop
  @handler.close
  @thread.join
end

#startObject



118
119
120
121
122
123
# File 'lib/fluent/plugin/socket_util.rb', line 118

def start
  @loop = Coolio::Loop.new
  @handler = listen(method(:on_message))
  @loop.attach(@handler)
  @thread = Thread.new(&method(:run))
end