faktory 0.5.0

API bindings for the language-agnostic Faktory work server

faktory

Crates.io Documentation Build Status

API bindings for Faktory workers and job producers.

This crate provides API bindings for the language-agnostic Faktory work server.

Producing jobs

If you want to submit jobs to Faktory, use Producer.

use std::net::TcpStream;
let mut p = Producer::<TcpStream>::connect_env().unwrap();
p.enqueue(Job::new("foobar", vec!["z"])).unwrap();

Consuming jobs (i.e., workers)

If you want to accept jobs from Faktory, use Consumer.

use std::io;
use std::net::TcpStream;
let mut c = ConsumerBuilder::default().connect_env::<TcpStream, _>().unwrap();
c.register("foobar", |job| -> io::Result<()> {
    println!("{:?}", job);
    Ok(())
});
if let Err(e) = c.run(&["default"]) {
    println!("worker failed: {}", e);
}