Documentation
¶
Overview ¶
Package async implements job.Handler interface.
Example ¶
package main import ( "fmt" "github.com/armen/dp/job" "github.com/armen/dp/job/handler/async" ) func main() { var msg = make(chan string) jh := async.New() jh.Confirm(func(j job.Job) { msg <- fmt.Sprintln("Confirmed", j) }) jh.Submit("Job 1") jh.Submit("Job 2") jh.Submit("Job 3") fmt.Print(<-msg) fmt.Print(<-msg) fmt.Print(<-msg) }
Output: Confirmed Job 1 Confirmed Job 2 Confirmed Job 3
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JobHandler ¶
type JobHandler struct {
// contains filtered or unexported fields
}
JobHandler stores the state of an asynchronous job handler.
func (*JobHandler) Confirm ¶
func (jh *JobHandler) Confirm(f func(job.Job))
Confirm registers the confirm handler.
func (*JobHandler) Process ¶
func (jh *JobHandler) Process(f func(job.Job))
Process registers the process handler.
func (*JobHandler) Submit ¶
func (jh *JobHandler) Submit(j job.Job)
Submit submits a job to be processed.
Click to show internal directories.
Click to hide internal directories.