Skip to content

jsanders/rusque

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Rusque

Resque compatible worker library for Rust. Inspired by goworker.

Disclaimer

This basically works, with the caveat that a job is currently just an unparsed string of json.

Installation

You can use rustpkg to install rusque:

$ rustpkg install github.com/jsanders/rusque

Usage

Import rusque:

extern mod rusque;

Create a worker function:

fn basic_worker(job: rusque::Job) -> rusque::Result {
  println!("I've been asked to work on {:s}", job.job);
  rusque::Ok
}

Create a worker to handle a list of queues:

let mut worker = rusque::Worker::new(~[~"basic_queue"], basic_worker);

Now work on jobs:

rusque.work()

This will block until an error occurs.

See the whole thing in action! Run:

$ cd examples/basics
$ rustpkg install github.com/jsanders/rusque
$ ruby basics.rb
$ rust run basics.rs &
I've been asked to work on Basic with args ~[~"some", ~"args"]
$ ruby basics.rb
I've been asked to work on Basic with args ~[~"some", ~"args"]
$ ruby basics.rb
I've been asked to work on Basic with args ~[~"some", ~"args"]
$ kill %1

About

Resque workers for Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published