ik5 / goworkqueue

Super simple, concurrent worker queue in golang

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GoWorkQueue

Super simple single-node job queue with managed workers. Perfect for small jobs like digesting streams or simple crawl jobs.

No race conditions and has a graceful shutdown.

Install

go get github.com/xeoncross/goworkqueue

Usage

Create a new queue instance with a callback for each job you want run.

queue := goworkqueue.NewQueue(1000, 5, func(job interface{}, workerID int) {
  fmt.Println("Processing", job)
})
queue.Add("one")  // anything can add "jobs" to process
queue.Run()       // Blocks until queue.Close() is called

See the example/example.go for more information.

Released Free under the MIT license http://davidpennington.me

About

Super simple, concurrent worker queue in golang


Languages

Language:Go 100.0%