disqrust

Crates.iodisqrust
lib.rsdisqrust
version0.1.0
sourcesrc
created_at2015-08-20 06:40:07.290797
updated_at2015-12-11 23:58:31.338387
descriptionA high-level library to implement Disque workers
homepage
repositoryhttps://github.com/seppo0010/disqrust
max_upload_size
id2882
size27,549
Sebastian Waisbrot (seppo0010)

documentation

http://seppo0010.github.io/disqrust/

README

disqrust

Build Status crates.io

A high-level library to implement Disque workers.

The crate is called disqrust and you can depend on it via cargo:

[dependencies]
disqrust = "0.1.0"

It currently requires Rust Beta or Nightly.

Basic Operation

extern crate disque;
extern crate disqrust;

use disque::Disque;
use disqrust::{EventLoop, Handler, JobStatus};

#[derive(Clone)]
struct MyHandler(u8);

impl Handler for MyHandler {
    fn process_job(&self, queue_name: &[u8], jobid: &String, body: Vec<u8>) -> JobStatus {
        match queue_name {
            b"send email" => { /* send email */; JobStatus::AckJob },
            _ => JobStatus::NAck,
        }
    }
}

fn main() {
    let disque = Disque::open("redis://127.0.0.1:7711/").unwrap();
    let mut el = EventLoop::new(disque, 4, MyHandler(0));
    el.watch_queue(b"my queue".to_vec());
    el.run(1000);
}

Documentation

For a more comprehensive documentation with all the available functions and parameters go to http://seppo0010.github.io/disqrust/

For a complete reference on Disque, check out https://github.com/antirez/disque

Commit count: 35

cargo fmt