Struct disque::AddJobBuilder [] [src]

pub struct AddJobBuilder<'a> {
    // some fields omitted
}

Helper to add a new job

Examples


let disque = Disque::open("redis://127.0.0.1:7711/").unwrap();
let jobid = AddJobBuilder::new(b"example queue", b"my job", 10000
    ).delay(1440).run(&disque).unwrap();

Methods

impl<'a> AddJobBuilder<'a>

fn new(queue_name: &'a [u8], job: &'a [u8], timeout_ms: u64) -> AddJobBuilder<'a>

Creates a new builder for queue_name. Timeout is specified in milliseconds.

fn queue_name(&mut self, queue_name: &'a [u8]) -> &mut Self

Changes the queue name where the job will be added.

fn job(&mut self, job: &'a [u8]) -> &mut Self

Changes the job body.

fn timeout(&mut self, timeout_ms: u64) -> &mut Self

Changes the timeout. It must be specified in milliseconds.

fn replicate(&mut self, replicate: usize) -> &mut Self

The number of nodes the job should be replicated to.

fn delay(&mut self, delay: u64) -> &mut Self

The number of seconds that should elapse before the job is queued.

fn retry(&mut self, retry: u64) -> &mut Self

Period after which, if no ACK is received, the job is put again into the queue for delivery

fn ttl(&mut self, ttl: u64) -> &mut Self

The max job life in seconds. After this time, the job is deleted even if it was not successfully delivered.

fn maxlen(&mut self, maxlen: usize) -> &mut Self

If there are already count messages queued for the specified queue name, the message is refused and an error reported to the client.

fn async(&mut self, async: bool) -> &mut Self

If true, asks the server to let the command return ASAP and replicate the job to other nodes in the background. Otherwise, the job is put into the queue only when the client gets a positive reply.

fn run(&self, disque: &Disque) -> RedisResult<String>

Executes the addjob command.