#background-jobs #redis #queue

bisonmq

A Lightweight and Simple Rust Library for Job Queue

8 releases

new 0.1.7 Mar 22, 2025
0.1.6 Mar 15, 2025
0.1.2 Feb 14, 2025

#1109 in Database interfaces

Download history 295/week @ 2025-02-10 61/week @ 2025-02-17 196/week @ 2025-02-24 80/week @ 2025-03-03 209/week @ 2025-03-10 129/week @ 2025-03-17

614 downloads per month

Apache-2.0

12KB
166 lines

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).await?;

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).await?;

Use the listener

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

Dependencies

~7–17MB
~206K SLoC