Simple Resque queue client for Go
Go
Switch branches/tags
Nothing to show
Latest commit 7664d19 Oct 29, 2015 @kavu Merge pull request #5 from yudppp/bugfix/enqueue_push
Replace lpush with rpush.
Permalink
Failed to load latest commit information.
driver Calm down golint Oct 9, 2014
go-redis Replace lpush with rpush. Mar 2, 2015
godis
hoisie
redigo Replace lpush with rpush. Mar 2, 2015
redisv2
.gitignore New Driver System Feb 4, 2014
LICENSE Add LICENSE Oct 9, 2014
README.md Cleanup README Oct 9, 2014
resque.go Fix according to style Oct 9, 2014

README.md

go-resque

Simple Resque queue client for Go.

Installation

Installation is simple and familiar for Go programmers:

go get github.com/kavu/go-resque

Usage

Let's assume that you have such Resque Job (taken from Resque examples):

module Demo
  class Job
    def self.perform(params)
      puts "Processed a job!"
    end
  end
end

So, we can enqueue this job from Go.

package main

import (
  "github.com/kavu/go-resque" // Import this package
  _ "github.com/kavu/go-resque/godis" // Use godis driver
  "github.com/simonz05/godis/redis" // Redis client from godis package
)

func main() {
  var err error

  client := redis.New("tcp:127.0.0.1:6379", 0, "") // Create new Redis client to use for enqueuing
  enqueuer := resque.NewRedisEnqueuer("godis", client) // Create enqueuer instance

  // Enqueue the job into the "go" queue with appropriate client
  _, err = enqueuer.Enqueue("resque:queue:go", "Demo::Job")
  if err != nil {
    panic(err)
  }

  // Enqueue into the "default" queue with passing one parameter to the Demo::Job.perform
  _, err = enqueuer.Enqueue("resque:queue:default", "Demo::Job", 1)
  if err != nil {
    panic(err)
  }

  // Enqueue into the "extra" queue with passing multiple
  // parameters to the Demo::Job.perform so it will fail
  _, err = enqueuer.Enqueue("resque:queue:extra", "Demo::Job", 1, 2, "woot")
  if err != nil {
    panic(err)
  }

}

Simple enough? I hope so.

Contributing

Just open pull request or ping me directly on e-mail, if you want to discuss some ideas.