Documentation ¶
Index ¶
- func Errors(errs ...stream.ErrorCloser) <-chan error
- func ErrorsChan(ch chan error, disabled bool) chan error
- func HandleErrors(ch chan error, logger func(msg string, fields ...zapcore.Field))
- func HandleInterrupts(signals chan os.Signal, closer func() error, logger *zap.Logger)
- func Interrupt() <-chan os.Signal
- func Usage(out io.Writer, about About) bool
- type About
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Errors ¶
func Errors(errs ...stream.ErrorCloser) <-chan error
Errors takes a list of stream consumers and/or producers, and returns a combined errors channel on which any errors reported by the processors are delivered.
func ErrorsChan ¶
ErrorsChan returns the passed in errors channel, unless `disabled` is set to `true`, in which case a temporary new errors channel is created, and an error is returned, indicating that the errors channel cannot be used with the current streamconfig.
func HandleErrors ¶
HandleErrors listens to the provided channel, and triggers a fatal error when any error is received.
func HandleInterrupts ¶
HandleInterrupts monitors for an interrupt signal, and calls the provided closer function once received. It has a built-in timeout capability to force terminate the application when the closer takes too long to close, or returns an error during closing.
func Interrupt ¶
Interrupt returns a channel that receives a signal when the application receives either an SIGINT or SIGTERM signal. This is provided for convenience when dealing with a select statement and receiving stream messages, making it easy to cleanly exit after fully handling one message, but before handling the next message.