Documentation ¶
Overview ¶
Package baseworker provides a simple wrapper around a Gearman worker, based on http://godoc.org/github.com/mikespook/gearman-go.
Example ¶
Here's an example program that just listens for "test" jobs and logs the data that it receives:
package main import( "github.com/Clever/baseworker-go" "log" ) func jobFunc(job baseworker.Job) ([]byte, error) { log.Printf("Got job with data %s", job.Data()) return []byte{}, nil } func main() { worker := baseworker.NewWorker("test", jobFunc) defer worker.Close() worker.Listen("localhost", "4730") }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job gearmanWorker.Job
Job is an alias for http://godoc.org/github.com/mikespook/gearman-go/worker#Job.
type SigtermHandler ¶
type SigtermHandler func(*Worker)
SigtermHandler is the definition for the function called after the worker receives a TERM signal.
Click to show internal directories.
Click to hide internal directories.