Struct oppgave::Queue [] [src]

pub struct Queue { /* fields omitted */ }

A Queue allows to push new tasks or wait for them

Allows for reliable job processing.

On fetch jobs are moved to a backup queue. They are popped from the backup queue, when the returned task guard is dropped.

Example

#[derive(RustcDecodable, RustcEncodable)]
struct Job { id: u64 }

let client = redis::Client::open("redis://127.0.0.1/").unwrap();
let con = client.get_connection().unwrap();
let producer = Queue::new("default".into(), con);

producer.push(Job{ id: 42 });

Methods

impl Queue
[src]

Create a new Queue for the given name

Stop processing the queue

On the next .next() call None will be returned.

Check if queue processing is stopped

Get the full queue name

Get the full backup queue name

Get the number of remaining tasks in the queue

Push a new task to the queue

Grab the next task from the queue

This method blocks and waits until a new task is available.