Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunWorker ¶
RunWorker creates an fx.Invoke that registers and starts a worker for the given dependency type. The dependency must have a Run(ctx context.Context) error method.
Options:
- WithReady(): wait for all components to be ready before starting
- WithTrafficReady(): wait for traffic readiness before starting
- WithShutdown(): trigger application shutdown on fatal error
Example:
fx.Invoke(
worker.RunWorker[*reader]("reader", worker.WithTrafficReady(), worker.WithShutdown()),
worker.RunWorker[*processor]("processor", worker.WithReady()),
)
Types ¶
type Option ¶
type Option func(*Options)
Option is a functional option for configuring a worker.
func WithReady ¶
func WithReady() Option
WithReady makes the worker wait for all components to be ready before starting.
func WithShutdown ¶
func WithShutdown() Option
WithShutdown makes the worker trigger application shutdown on fatal error.
func WithTrafficReady ¶
func WithTrafficReady() Option
WithTrafficReady makes the worker wait for traffic readiness before starting.
Click to show internal directories.
Click to hide internal directories.