Crates.io | oppgave |
lib.rs | oppgave |
version | 0.1.0 |
source | src |
created_at | 2016-02-14 18:48:45.030405 |
updated_at | 2016-02-14 18:48:45.030405 |
description | A simple Redis-based task queue |
homepage | https://github.com/badboy/oppgave |
repository | https://github.com/badboy/oppgave |
max_upload_size | |
id | 4178 |
size | 14,158 |
A small reliable queue on top of Redis. Allows to push tasks and fetch them again. Can handle whatever task object you hand it, as long as it can be encoded and decoded to and from JSON.
oppgave
is Norwegian for task.
So oppgave
is a oppgave kø, a task queue.
Sadly, characters like ø
don't play to well with stable Rust. Non-ASCII identifiers are feature-gated.
If you are okay with using nightly, you can get oppgave-kø
instead and add #![feature(non_ascii_idents)]
to your main crate file.
Documentation is available online.
Add it to your dependencies in Cargo.toml
[dependencies]
oppgave = "0.1.0"
See examples/worker.rs
for a working example.
Run it with cargo run --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 producer = Queue::new("default".into(), con);
producer.push(Job{ id: 42 });
See examples/worker.rs
for a working example.
Run it with cargo run --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);
}
MIT. See LICENSE.