What are the task-queuing software/library that able to be used from Go programming language?
2 Answers
Check out Disque, the Persistent Distributed Job Priority Queue from the author of Redis. There are several Golang clients for Disque, eg.:
https://github.com/goware/disque
import ( "github.com/goware/disque" ) func producer() { // Connect to Disque pool. jobs, _ := disque.New("127.0.0.1:7711") // Accepts more arguments. defer jobs.Close() // Enqueue three jobs with different priorities. job1, _ := jobs.Add(data1, "high") job2, _ := jobs.Add(data2, "low") job3, _ := jobs.Add(data3, "urgent") // Block until job3 is done. jobs.Wait(job3) } func consumer() { // Connect to Disque pool. jobs, _ := disque.New("127.0.0.1:7711") // Accepts more arguments. defer jobs.Close() for { // Get job from highest priority queue possible. Blocks by default. job, _ := jobs.Get("urgent", "high", "low") // Left-to-right priority. // Do some hard work with the job data. if err := Process(job.Data); err != nil { // Failed. Re-queue the job. jobs.Nack(job) } // Acknowledge (dequeue) the job. jobs.Ack(job) } }
- https://github.com/zencoder/disque-go
RedisMQ is a fast, persistent, atomic message queue implementation that uses redis as its storage engine written in go. It uses atomic list commands to ensure that messages are delivered only once in the right order without being lost by crashing consumers.
This one looks quite easy to use.