Crate gearman_worker

Source
Expand description

§gearman-worker

The gearman-worker crate provides a high level library to easily implement gearman Workers.

It handles registration of functions as jobs in the gearman queue server, fetching of jobs and their workload.

§Usage

use gearman_worker::WorkerBuilder;

fn main() {
    let mut worker = WorkerBuilder::default().build();
    worker.connect().unwrap();

    worker.register_function("greet", |input| {
        let hello = String::from_utf8_lossy(input);
        let response = format!("{} world!", hello);
        Ok(response.into_bytes())
    }).unwrap();

    worker.run().unwrap();
}

Structs§

Worker
The Worker processes jobs provided by the gearman queue server.
WorkerBuilder
Helps building a new Worker