Crates.io | beanstalkc |
lib.rs | beanstalkc |
version | 1.0.0 |
source | src |
created_at | 2019-02-14 05:32:39.608332 |
updated_at | 2020-10-02 04:07:27.274795 |
description | Yet another simple Beanstalkd client for Rust. |
homepage | https://github.com/iFaceless/beanstalkc-rust |
repository | https://github.com/iFaceless/beanstalkc-rust |
max_upload_size | |
id | 114677 |
size | 83,170 |
Beanstalkd is a fast, general-purpose work queue. beanstalkc-rust is a Beanstalkd Client to communicate with Beanstalkd Server based on the protocol defined here.
Inspired by rust-beanstalkd and beanstalkc.
Several repositories can be found from here, why not just using one of those directly? The reasons are as follows:
Note: :) version 1.x is no longer compatible with the old ones. Job body now returns raw bytes instead of UTF-8 string. Modification can be found here.
Add this dependency to your Cargo.toml
~
beanstalkc = "^1.0.0"
Full documentation can be found here.
More examples can be found here.
use beanstalkc::Beanstalkc;
use std::time;
fn main() {
let mut conn = Beanstalkc::new()
.host("127.0.0.1")
.port(11300)
.connection_timeout(Some(time::Duration::from_secs(10)))
.connect()
.expect("connection failed");
conn.use_tube("jobs").unwrap();
conn.put_default(b"hello, world").unwrap();
conn.put(
b"Hello, rust world.",
0,
time::Duration::from_secs(100),
time::Duration::from_secs(1800)
)
}
use beanstalkc::Beanstalkc;
use std::time;
fn main() {
let mut conn = Beanstalkc::new()
.host("127.0.0.1")
.port(11300)
.connection_timeout(Some(time::Duration::from_secs(10)))
.connect()
.expect("connection failed");
conn.watch("jobs").unwrap();
let mut job = conn.reserve().unwrap();
println!("{:#?}", job.stats());
job.delete().unwrap();
}
Licensed under the MIT license
Please feel free to report any issues~