benthos

module
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2017 License: MIT

README

Benthos

godoc for jeffail/benthos goreportcard for jeffail/benthos

Benthos is a service that reads messages from any sources and writes them to any sinks. It bridges services and tools together in ways that can simplify your platform or reduce development time.

A range of optional buffer strategies are available, allowing you to select a balance between latency, protection against back pressure and file based persistence, or nothing at all (direct bridge).

Supported Protocols

Arch Diagram

Currently supported input/output targets:

Setting up multiple outputs or inputs is done by choosing a routing strategy (fan in, fan out, round robin, etc.)

For a full and up to date list of all inputs, buffer options, and outputs you can print them from the binary:

# Print inputs, buffers and output options
benthos --print-inputs --print-buffers --print-outputs | less

Mixing multiple part message protocols with single part can be done in different ways, for more guidance check out this doc.

Install

Build with Go:

go get github.com/jeffail/benthos/cmd/...

Or, download from here.

Run

benthos -c ./config.yaml

Config

Benthos has inputs, optional processors, an optional buffer, and outputs, which are all set in a single config file.

Check out the samples in ./config, or create a fully populated default configuration file:

benthos --print-yaml > config.yaml
benthos --print-json > config.json

The configuration file should contain a section for an input, output, and a buffer. For example, if we wanted to output to a ZMQ4 push socket our output section in a YAML config might look like this:

output:
  type: zmq4
  zmq4:
    addresses:
      - tcp://*:1234
    socket_type: PUSH

There are also configuration sections for logging and metrics, if you print an example config you will see the available options.

For a list of metrics within Benthos check out this spec.

ZMQ4 Support

Benthos supports ZMQ4 for both data input and output. To add this you need to install libzmq4 and use the compile time flag when building benthos:

go install -tags "ZMQ4" ./cmd/...

Vendoring

Benthos uses dep for managing dependencies. To get started make sure you have dep installed:

go get -u github.com/golang/dep/cmd/dep

And then run dep ensure. You can decrease the size of vendor by only storing needed files with dep prune.

Docker

There's a Dockerfile for creating a benthos docker image. This is built from scratch and so you'll need to build without CGO (CGO_ENABLED=0) for your benthos build to run within it. Create it like this:

CGO_ENABLED=0 make docker
docker run --rm benthos

Then use the image:

docker run --rm -v ~/benthos.yaml:/config.yaml -v /tmp/data:/data -p 8080:8080 \
	benthos -c /config.yaml

Directories

Path Synopsis
cmd
lib
broker
Package broker implements types used for routing inputs to outputs in non-trivial arrangements, such as fan-out or fan-in models.
Package broker implements types used for routing inputs to outputs in non-trivial arrangements, such as fan-out or fan-in models.
buffer
Package buffer links an input and an output together and buffers messages in between.
Package buffer links an input and an output together and buffers messages in between.
buffer/impl
Package impl contains implementations of various buffer types.
Package impl contains implementations of various buffer types.
input
Package input defines consumers for aggregating data from a variety of sources.
Package input defines consumers for aggregating data from a variety of sources.
output
Package output defines dispatchers of data for a variety of targets.
Package output defines dispatchers of data for a variety of targets.
pipeline
Package pipeline contains structures that implement both the Producer and Consumer interfaces.
Package pipeline contains structures that implement both the Producer and Consumer interfaces.
processor
Package processor contains logical message processors that can be pipelined within benthos using the pipeline.Processor type.
Package processor contains logical message processors that can be pipelined within benthos using the pipeline.Processor type.
types
Package types defines any general structs and interfaces used throughout the benthos code base.
Package types defines any general structs and interfaces used throughout the benthos code base.
util/disk
Package disk contains cross platform disk statistics utilities.
Package disk contains cross platform disk statistics utilities.
util/test
Package test contains helpers for setting up test utilties.
Package test contains helpers for setting up test utilties.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL