Skip to content
Benthos plugin examples
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cache Upgrade to Benthos v2 (dirty) May 14, 2019
cmd/benthos-plugin-example Upgrade to Benthos v2 (dirty) May 14, 2019
condition
input Add output example Apr 21, 2019
output Add output example Apr 21, 2019
processor Add more examples, flesh out into new binary build Feb 28, 2019
ratelimit Upgrade to Benthos v2 (dirty) May 14, 2019
.gitignore Add output example Apr 21, 2019
LICENSE Add license Feb 28, 2019
README.md Add output example Apr 21, 2019
go.mod Upgrade to Benthos v2 (dirty) May 14, 2019

README.md

Benthos Plugin Example

This project demonstrates the recommended way to build your own Benthos component plugins and run them in a custom distribution.

Build

Start by writing your plugins where ever you like, there are examples in this repo for inputs, processors, conditions and outputs to copy from.

Next, copy the Benthos main func and add your plugin packages as dependencies at the top as shown in this example.

Finally, build your custom main func:

go build ./cmd/benthos-plugin-example

Run

The new service you've built will come with all of the usual Benthos components plus all of your custom plugins, which you can use like any other type. The only difference between your plugins and original Benthos components is that the config field for plugin specific fields is always plugin.

For example, to use the example plugin components gibberish, is_all_caps, reverse and blue_stdout our config might look like this:

input:
  type: gibberish
  plugin:
    length: 80

pipeline:
  processors:
  - type: throttle
    throttle:
      period: 1s
  - type: reverse
  - type: filter_parts
    filter_parts:
      type: not
      not:
        type: is_all_caps

output:
  type: blue_stdout

And you can run it like this:

./benthos-plugin-example -c ./yourconfig.yaml

You can’t perform that action at this time.