service

package
v3.15.4 Latest Latest
Warning

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

Go to latest
Published: May 30, 2020 License: MIT Imports: 35 Imported by: 0

Documentation

Overview

Package service contains the main execution logic of the Benthos service, which is responsible for parsing commandline flags, running a stream and capturing termination signals.

Index

Constants

This section is empty.

Variables

View Source
var (
	Version   string
	DateBuilt string
)

Build stamps.

Functions

func OptOnManagerInit

func OptOnManagerInit(fn ManagerInitFunc) func()

OptOnManagerInit creates an opt func that allows you to specify a function to be called once the service manager is constructed.

func OptOverrideConfigDefaults

func OptOverrideConfigDefaults(fn func(c *config.Type)) func()

OptOverrideConfigDefaults creates an opt func that allows the provided func to override config struct default values before the user config is parsed.

func OptSetServiceName

func OptSetServiceName(name string) func()

OptSetServiceName creates an opt func that allows the default service name config fields such as metrics and logging prefixes to be overridden.

func OptSetVersionStamp

func OptSetVersionStamp(version, dateBuilt string) func()

OptSetVersionStamp creates an opt func for setting the version and date built stamps that Benthos returns via --version and the /version endpoint. The traditional way of setting these values is via the build flags: -X github.com/Jeffail/benthos/v3/lib/service.Version=$(VERSION) and -X github.com/Jeffail/benthos/v3/lib/service.DateBuilt=$(DATE)

func Run

func Run()

Run the Benthos service, if the pipeline is started successfully then this call blocks until either the pipeline shuts down or a termination signal is received.

func RunWithOpts

func RunWithOpts(opts ...func())

RunWithOpts runs the Benthos service after first applying opt funcs, which are used for specify service customisations.

Types

type ManagerInitFunc

type ManagerInitFunc func(manager types.Manager, logger log.Modular, stats metrics.Type) error

ManagerInitFunc is a function to be called once the Benthos service manager, which manages resources shared across all components, is initialised. This is a useful time to add additional resources that might be required for custom plugins. If a non-nil error is returned the service will terminate.

Directories

Path Synopsis
Package test implements the Benthos service unit testing command.
Package test implements the Benthos service unit testing command.

Jump to

Keyboard shortcuts

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