Struct rjq::Queue
[−]
[src]
pub struct Queue { /* fields omitted */ }
Queue
Methods
impl Queue
[src]
fn new(url: &str, name: &str) -> Queue
Init new queue object
url
- redis url to connect
name
- queue name
fn drop(&self) -> Result<(), Box<Error>>
Delete enqueued jobs
fn enqueue(
&self,
args: Vec<String>,
expire: usize
) -> Result<String, Box<Error>>
&self,
args: Vec<String>,
expire: usize
) -> Result<String, Box<Error>>
Enqueue new job
args
- job arguments
expire
- job expiration time in seconds, if hasn't started during this time it will be
removed
Returns unique job identifier
fn status(&self, uuid: &str) -> Result<Status, Box<Error>>
Get job status
uuid
- unique job identifier
Returns job status
fn work<F: Fn(String, Vec<String>) -> Result<String, Box<Error>> + Send + Sync + 'static>(
&self,
fun: F,
wait: Option<usize>,
timeout: Option<usize>,
freq: Option<usize>,
expire: Option<usize>,
fall: Option<bool>,
infinite: Option<bool>
) -> Result<(), Box<Error>>
&self,
fun: F,
wait: Option<usize>,
timeout: Option<usize>,
freq: Option<usize>,
expire: Option<usize>,
fall: Option<bool>,
infinite: Option<bool>
) -> Result<(), Box<Error>>
Work on queue, process enqueued jobs
fun
- function that would work on jobs
wait
- timeout in seconds to wait for one iteration of BLPOP, 10 by default
timeout
- timeout in seconds, if job hasn't been completed during this time, it will be
marked as lost, 30 by default
freq
- frequency of checking job status while counting on timeout, number of checks per
second, 1 by default
expire
- job result expiration time in seconds, 30 by default
fall
- panic if job was lost, true by default
infinite
- process jobs infinitely, true by default
fn result(&self, uuid: &str) -> Result<Option<String>, Box<Error>>
Get job result
uuid
- unique job identifier
Returns job result