GithubHelp home page GithubHelp logo

go-resque's Introduction

go-resque

Simple Resque queue client for Go.

Introduction

This is a fork of go-resque.

Modifications:

  • go mod
  • added go-redis@v7 driver
  • remove drivers that no long exist.

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.

go-resque's People

Contributors

cosmicz avatar jazibjohar avatar julsemaan avatar kavu avatar sonots avatar szmcdull avatar tomfw avatar yudppp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.