service

package
v3.35.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2020 License: MIT Imports: 43 Imported by: 5

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 OptAddStringFlag added in v3.19.0

func OptAddStringFlag(name, usage string, aliases []string, value string, destination *string) func()

OptAddStringFlag registers a custom CLI flag for the standard Benthos run command.

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 OptWithAPIMiddleware added in v3.35.0

func OptWithAPIMiddleware(m func(http.Handler) http.Handler) func()

OptWithAPIMiddleware adds an HTTP middleware to the Benthos API.

func OptWithAPITLS added in v3.35.0

func OptWithAPITLS(c *tls.Config) func()

OptWithAPITLS replaces the default TLS options of the Benthos API server.

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