class Fluent::UdpEventInput::UdpHandler

Class to handle the UDP layer

Public Class Methods

new(io, max_message_size, callback) click to toggle source
Calls superclass method
# File lib/fluent/plugin/in_udp_event.rb, line 108
def initialize(io, max_message_size, callback)
  super(io)
  @io = io
  @callback = callback
  @max_message_size = max_message_size
end

Public Instance Methods

on_readable() click to toggle source
# File lib/fluent/plugin/in_udp_event.rb, line 115
def on_readable
  msg, _ = @io.recvfrom_nonblock(@max_message_size)
  @callback.call(msg)
rescue Exception => e
  $log.error e.message, error: e.message
end