1 unstable release
Uses old Rust 2015
0.1.0 | Feb 14, 2016 |
---|
#32 in #task-queue
30 downloads per month
13KB
219 lines
oppgave - A simple Redis-based task queue
Documentation
Documentation is available online
Installation
Add it to your dependencies in Cargo.toml
[dependencies]
oppgave = "0.1.0"
Example: Producer
#[derive(RustcDecodable, RustcEncodable)]
struct Job { id: u64 }
let client = redis::Client::open("redis://127.0.0.1/").unwrap();
let con = client.get_connection().unwrap();
let producer = Queue::new("default".into(), con);
producer.push(Job{ id: 42 });
Example: Worker
#[derive(RustcDecodable, RustcEncodable)]
struct Job { id: u64 }
let client = redis::Client::open("redis://127.0.0.1/").unwrap();
let con = client.get_connection().unwrap();
let worker = Queue::new("default".into(), con);
while let Some(task) = worker.next() {
println!("Working with Job {}", job.id);
}
License
MIT. See LICENSE.
Dependencies
~3MB
~84K SLoC