Skip to content

Leaf48/BisonMQ

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

BisonMQ

A Lightweight and Simple Rust Library for Job Queue

The gist

installation

cargo add bisonmq

Push a job to the queue

let job_queue: JobQueue = JobQueue::new("redis://127.0.0.1/", queue_key)?;
// return the length of the queue
let len: i64 = job_queue.push_job(&queue_value)?;

Pop a job from the queue

let job_queue: JobQueue = JobQueue::new("redis://127.0.0.1/", queue_key)?;

// 0.0 means waiting forever
let result: (String, String) = job_queue.pop_job(0.0);

Use the listener

let listen_handler = job_queue.listen(0.0, move |(queue_key, value)| {
  println!("[Listener] Queue: {}, Job: {}", queue_key, value);
});

About

A Lightweight and Simple Rust Library for Job Queue

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published