class Fluent::Plugin::TcpOutput

Public Instance Methods

try_write(chunk) click to toggle source

omit configure, shutdown and other plugin API

# File lib/fluent/plugin/out_tcp_output.rb, line 14
def try_write(chunk)
  # 2. create socket
  socket = socket_create(:tcp, @host, @port)
  chunk.each do |time, record|
    # 3. write data to socket
    socket.write(record.to_json)
  end
ensure
  # 4. close socket
  socket.close if socket
end