Redis Job Queue
Simple redis job queue
Enqueue jobs and check their statuses and results
extern crate rjq;
use Duration;
use sleep;
use ;
Queue worker example
extern crate rjq;
use Duration;
use sleep;
use Error;
use ;
Job status
QUEUED - job queued for further processing
RUNNING - job is running by worker
LOST - job has not been finished in time
FINISHED - job has been successfully finished
FAILED - job has been failed due to some errors
Queue functions
Init queue
;
url - redis URL
name - queue name
Returns queue
Drop queue jobs
;
Enqueue job
;
args - job arguments
expire - if job has not been started by worker in this time (in seconds), it will expire
Returns job UUID
Get job status
;
uuid - job unique identifier
Returns job status
Work on queue
;
wait - time to wait for BLPOP
fun - worker function
timeout - worker function should finish in timeout (in seconds)
freq - job status check frequency (times per second)
expire - job result will expire in this time (in seconds)
fall - panic, if job has been lost, to unwind and free resources
infinite - process jobs infinitely, otherwise only one job will be processed
Get job result
;
uuid - job unique identifier
Returns job result
Run tests