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 ¶
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 ¶
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 ¶
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.