Class: Fluent::UdpEventInput::UdpHandler
- Inherits:
-
Coolio::IO
- Object
- Coolio::IO
- Fluent::UdpEventInput::UdpHandler
- Defined in:
- lib/fluent/plugin/in_udp_event.rb
Overview
Class to handle the UDP layer
Instance Method Summary collapse
-
#initialize(io, max_message_size, callback) ⇒ UdpHandler
constructor
A new instance of UdpHandler.
- #on_readable ⇒ Object
Constructor Details
#initialize(io, max_message_size, callback) ⇒ UdpHandler
Returns a new instance of UdpHandler.
109 110 111 112 113 114 |
# File 'lib/fluent/plugin/in_udp_event.rb', line 109 def initialize(io, , callback) super(io) @io = io @callback = callback @max_message_size = end |
Instance Method Details
#on_readable ⇒ Object
116 117 118 119 120 121 |
# File 'lib/fluent/plugin/in_udp_event.rb', line 116 def on_readable msg, _ = @io.recvfrom_nonblock(@max_message_size) @callback.call(msg) rescue Exception => e $log.error e., error: e. end |