Worker.NewWorker
Overview
NewWorker creates a worker that dispatches to mux.
Part of the queue package — Node.js analog: bull.
Method on Worker — call it on a value of that type after constructing or receiving one from a constructor.
Signature
go
func NewWorker(redisAddr string, mux *ServeMux) *WorkerCompare: Node.js · Standard Go · gox
js
// Typical bull pattern in Node.jsgo
// hibiken/asynq client + workergo
import "github.com/sahilkhaire/gox/queue"
worker := queue.NewWorker("localhost:6379", mux)Example
go
import "github.com/sahilkhaire/gox/queue"
worker := queue.NewWorker("localhost:6379", mux)Tips
Obtain a Worker value first (see constructors on the package overview), then call NewWorker.
Standard library alternative
gox wraps the Go standard library or a trusted dependency with Node-familiar naming. You can use the underlying library directly — see the package overview for escape hatches.