github.com/Jeffail/benthos/v3@v3.65.0/public/service/service.go (about) 1 package service 2 3 import ( 4 "context" 5 6 "github.com/Jeffail/benthos/v3/lib/service" 7 ) 8 9 // RunCLI executes Benthos as a CLI, allowing users to specify a configuration 10 // file path(s) and execute subcommands for linting configs, testing configs, 11 // etc. This is how a standard distribution of Benthos operates. 12 // 13 // This call blocks until either: 14 // 15 // 1. The service shuts down gracefully due to the inputs closing 16 // 2. A termination signal is received 17 // 3. The provided context is cancelled 18 // 19 // This function must only be called once during the entire lifecycle of your 20 // program, as it interacts with singleton state. In order to manage multiple 21 // Benthos stream lifecycles in a program use the StreamBuilder API instead. 22 func RunCLI(ctx context.Context) { 23 service.RunWithOpts(service.OptUseContext(ctx)) 24 }