Skip to content

Commit 3594265

Browse files
authored
developer-guide: Add threaded flag description on input plugin (fluent#947)
* developer-guide: Add threaded flag description on input plugin Signed-off-by: Hiroshi Hatake <hatake@calyptia.com>
1 parent 67670cc commit 3594265

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

development/developer-guide.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,25 @@ The input plugin structure is defined in [flb\_input.h](https://github.com/fluen
274274
275275
The [`"dummy"` input plugin](https://github.com/fluent/fluent-bit/tree/master/plugins/in_dummy) is very simple and is an excellent example to review to understand more.
276276
277+
Note that input plugins can use threaded mode if the flag `FLB_INPUT_THREADED` is provided.
278+
To enable threading in your plugin, add the `FLB_INPUT_THREADED` to the set of `flags` when registering:
279+
280+
```c
281+
struct flb_input_plugin in_your_example_plugin = {
282+
.name = "your example",
283+
.description = "Ingest example data",
284+
.cb_init = in_your_example_init,
285+
.cb_pre_run = NULL,
286+
.cb_collect = in_your_example_collect,
287+
.cb_flush_buf = NULL,
288+
.config_map = config_map,
289+
.cb_pause = in_your_example_pause,
290+
.cb_resume = in_example_resume,
291+
.cb_exit = in_example_exit,
292+
.flags = FLB_INPUT_THREADED
293+
};
294+
```
295+
277296
### Filter
278297

279298
The structure for filter plugins is defined in [flb\_filter.h](https://github.com/fluent/fluent-bit/blob/master/include/fluent-bit/flb_filter.h#L44). Each plugin must implement `cb_init`, `cb_filter`, and `cb_exit`.

0 commit comments

Comments
 (0)