Popularity
2.0
Stable
Activity
0.0
Stable
46
1
15

Programming language: Rust
License: Apache License 2.0
Tags: Ironmq     Queue     Worker     Beanstalkd    
Latest version: v0.4.1
Add another 'Beanstalkd' Package

README

rust-beanstalkd Build Status

Crates.io

Easy-to-use beanstalkd client for Rust (IronMQ compatible)

Install

Add this dependency to your Cargo.toml

beanstalkd = "*"

Documentation

More documentation can be found here.

Usage

Producer

extern crate beanstalkd;

use beanstalkd::Beanstalkd;

fn main() {
    let mut beanstalkd = Beanstalkd::localhost().unwrap();
    let _ = beanstalkd.put("Hello World", 0, 0, 10000);
}

Consumer

extern crate beanstalkd;

use beanstalkd::Beanstalkd;

fn main() {
    let mut beanstalkd = Beanstalkd::localhost().unwrap();
    let (id, body) = beanstalkd.reserve().unwrap();
    println!("{}", body);
    let _ = beanstalkd.delete(id);
}

IronMQ example

extern crate beanstalkd;

use beanstalkd::Beanstalkd;

fn main() {
    let host = "mq-aws-us-east-1.iron.io";
    let token = "your token";
    let project_id = "your project id - not the name";

    let mut beanstalkd = Beanstalkd::connect(host, 11300).unwrap();
    let _ = beanstalkd.put(format!("oauth {} {}", token, project_id).as_slice(), 0, 0, 10000);
    let _ = beanstalkd.put("Hello World", 0, 0, 10000);
}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.


*Note that all licence references and agreements mentioned in the rust-beanstalkd README section above are relevant to that project's source code only.