#api-bindings #faktory #work-server #job-server

bin+lib faktory

API bindings for the language-agnostic Faktory work server

32 releases

0.12.1 Sep 17, 2022
0.12.0 May 28, 2022
0.11.1 Apr 27, 2021
0.11.0 Mar 3, 2020
0.8.8 Nov 14, 2017

#269 in Network programming

Download history 18/week @ 2022-11-29 89/week @ 2022-12-06 70/week @ 2022-12-13 32/week @ 2022-12-20 14/week @ 2022-12-27 54/week @ 2023-01-03 49/week @ 2023-01-10 63/week @ 2023-01-17 76/week @ 2023-01-24 92/week @ 2023-01-31 128/week @ 2023-02-07 164/week @ 2023-02-14 43/week @ 2023-02-21 20/week @ 2023-02-28 28/week @ 2023-03-07 53/week @ 2023-03-14

178 downloads per month


1.5K SLoC


Crates.io Documentation Codecov dependency status

API bindings for Faktory workers and job producers.

This crate provides API bindings for the language-agnostic Faktory work server. For a more detailed system overview of the work server, what jobs are, and how they are scheduled, see the Faktory docs.

System overview

At a high level, Faktory has two primary concepts: jobs and workers. Jobs are pieces of work that clients want to have executed, and workers are the things that eventually execute those jobs. A client enqueues a job, Faktory sends the job to an available worker (and waits if they're all busy), the worker executes the job, and eventually reports back to Faktory that the job has completed.

Jobs are self-contained, and consist of a job type (a string), arguments for the job, and bits and pieces of metadata. When a job is scheduled for execution, the worker is given this information, and uses the job type to figure out how to execute the job. You can think of job execution as a remote function call (or RPC) where the job type is the name of the function, and the job arguments are, perhaps unsuprisingly, the arguments to the function.

In this crate, you will find bindings both for submitting jobs (clients that produce jobs) and for executing jobs (workers that consume jobs). The former can be done by making a Producer, whereas the latter is done with a Consumer. See the documentation for each for more details on how to use them.

Encrypted connections (TLS)

To connect to a Faktory server hosted over TLS, add the tls feature, and see the documentation for TlsStream, which can be supplied to Producer::connect_with and Consumer::connect_with.


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

use faktory::{Producer, Job};
let mut p = Producer::connect(None).unwrap();
p.enqueue(Job::new("foobar", vec!["z"])).unwrap();

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

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


~649K SLoC