Fluentd
Search…
Plugin Helper: Event Loop
The event_loop plugin helper manages event loops.
Here is an example:
1
require 'fluent/plugin/input'
2
3
module Fluent::Plugin
4
class ExampleInput < Input
5
Fluent::Plugin.register_input('example', self)
6
7
# 1. Load `event_loop_helper`
8
helpers :event_loop
9
10
# Omit `configure`, `shutdown` and other plugin APIs
11
12
def start
13
super
14
15
# 2. Attach watcher
16
watcher = Coolio::TCPServer.new(...)
17
event_loop_attach(watcher)
18
end
19
end
20
end
Copied!
The attached watcher is managed by the plugin. No need of watcher detach code in plugin's shutdown. The plugin shutdowns the attached watchers automatically.

Methods

event_loop_attach(watcher)

This method attaches watcher to the event loop.
    watcher: Coolio::Watcher instances

Plugins using event_loop

If this article is incorrect or outdated, or omits critical information, please let us know. Fluentd is an open-source project under Cloud Native Computing Foundation (CNCF). All components are available under the Apache 2 License.
Last modified 4mo ago