bisonmq

Crates.iobisonmq
lib.rsbisonmq
version0.1.7
created_at2025-02-14 10:20:45.578053+00
updated_at2025-03-22 07:58:36.720167+00
descriptionA Lightweight and Simple Rust Library for Job Queue
homepage
repositoryhttps://github.com/Leaf48/BisonMQ
max_upload_size
id1555485
size32,561
wa (Leaf48)

documentation

README

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);
});
Commit count: 21

cargo fmt