[][src]Crate beanstalkc

A simple Beanstalkd client.

This crate provides a simple and easy-to-use beanstalkd client, which is inspired by beanstalkc and rust-beanstalkd.

Usage

[dependencies]
beanstalkc = "^0.2.0"

Producer

use std::time::Duration;
use beanstalkc::Beanstalkc;

let mut conn = Beanstalkc::new()
     .connect()
     .expect("connect to beanstalkd server failed");

conn.use_tube("jobs").unwrap();
conn.put_default(b"hello, world").unwrap();
conn.put(b"hello, rust", 1, Duration::from_secs(10), Duration::from_secs(1800)).unwrap();

Worker

use beanstalkc::Beanstalkc;

let mut conn = Beanstalkc::new()
     .connect()
     .expect("connect to beanstalkd server failed");

conn.watch("jobs").unwrap();

let mut job = conn.reserve().unwrap();
// execute job here...
job.delete().unwrap();

Structs

Beanstalkc

Beanstalkc provides beanstalkd client operations.

Job

Job is a simple abstraction about beanstalkd job.