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 ¶
- Variables
- func OptAddStringFlag(name, usage string, aliases []string, value string, destination *string) func()
- func OptOnManagerInit(fn ManagerInitFunc) func()
- func OptOverrideConfigDefaults(fn func(c *config.Type)) func()
- func OptSetServiceName(name string) func()
- func OptSetVersionStamp(version, dateBuilt string) func()
- func OptWithAPIMiddleware(m func(http.Handler) http.Handler) func()
- func OptWithAPITLS(c *tls.Config) func()
- func Run()
- func RunWithOpts(opts ...func())
- type ManagerInitFunc
Constants ¶
This section is empty.
Variables ¶
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 ¶
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
OptWithAPIMiddleware adds an HTTP middleware to the Benthos API.
func OptWithAPITLS ¶ added in v3.35.0
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 ¶
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.