Documentation ¶
Overview ¶
This package wants to offer the community and implement workers with the pure Go code for Golangers, without any other dependency just Uuid. It allows you to expose an http server to answer the response of health checks, stats, debug pprof and the main "workers". Workers for consumer queues, channel processes and other things that you think worker needs.
Index ¶
- type WorkerServer
- func (s *WorkerServer) CheckHealth(check func() bool) *WorkerServer
- func (s *WorkerServer) Configs() map[string]interface{}
- func (s *WorkerServer) DebugPprof() *WorkerServer
- func (s *WorkerServer) GracefulStop() error
- func (s *WorkerServer) HandleError(handle func(w *worker.Worker, err error)) *WorkerServer
- func (s *WorkerServer) HealthCheck() *WorkerServer
- func (s *WorkerServer) HealthCheckFunc(f func(writer http.ResponseWriter, request *http.Request)) *WorkerServer
- func (s *WorkerServer) Healthy() bool
- func (s *WorkerServer) Infos() map[string]interface{}
- func (s *WorkerServer) Run() error
- func (s *WorkerServer) Stats() *WorkerServer
- func (s *WorkerServer) StatsFunc(f func(writer http.ResponseWriter, request *http.Request)) *WorkerServer
- func (s *WorkerServer) Worker(name string, handle func(ctx context.Context) error, configs ...worker.Config) *WorkerServer
- func (s *WorkerServer) Workers() []*worker.Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WorkerServer ¶
type WorkerServer struct {
// contains filtered or unexported fields
}
WorkerServer is a server that administrate the workers and the monitor
func NewWithConfig ¶
func NewWithConfig(configs map[string]interface{}) *WorkerServer
NewWithConfig build an #WorkerServer by the settings
func (*WorkerServer) CheckHealth ¶ added in v0.1.11
func (s *WorkerServer) CheckHealth(check func() bool) *WorkerServer
CheckHealth includes to server checker the health
func (*WorkerServer) Configs ¶
func (s *WorkerServer) Configs() map[string]interface{}
Configs return the configs from #WorkerServer
func (*WorkerServer) DebugPprof ¶
func (s *WorkerServer) DebugPprof() *WorkerServer
DebugPprof setup for the server to start with /debug/pprof*
func (*WorkerServer) GracefulStop ¶ added in v0.3.1
func (s *WorkerServer) GracefulStop() error
GracefulStop stop the server gracefully
func (*WorkerServer) HandleError ¶
func (s *WorkerServer) HandleError(handle func(w *worker.Worker, err error)) *WorkerServer
HandleError setup the a function that will called when to occur and error
func (*WorkerServer) HealthCheck ¶
func (s *WorkerServer) HealthCheck() *WorkerServer
HealthCheck setup for the server to start with /health-check
func (*WorkerServer) HealthCheckFunc ¶
func (s *WorkerServer) HealthCheckFunc(f func(writer http.ResponseWriter, request *http.Request)) *WorkerServer
HealthCheckFunc setup the handler for /health-check
func (*WorkerServer) Healthy ¶ added in v0.1.11
func (s *WorkerServer) Healthy() bool
Healthy return true or false if the WorkerServer its ok or no, respectively
func (*WorkerServer) Infos ¶ added in v0.2.0
func (s *WorkerServer) Infos() map[string]interface{}
Infos return the infos about of WorkerServer
func (*WorkerServer) Stats ¶
func (s *WorkerServer) Stats() *WorkerServer
Stats setup for the server to start with /stats
func (*WorkerServer) StatsFunc ¶
func (s *WorkerServer) StatsFunc(f func(writer http.ResponseWriter, request *http.Request)) *WorkerServer
StatsFunc setup the handler for /stats
func (*WorkerServer) Worker ¶
func (s *WorkerServer) Worker(name string, handle func(ctx context.Context) error, configs ...worker.Config) *WorkerServer
Worker build an #Worker and add to execution with #WorkerServer
func (*WorkerServer) Workers ¶
func (s *WorkerServer) Workers() []*worker.Worker
Workers return the slice of #Worker configured