dispatch

Function dispatch 

Source
pub async fn dispatch<J>(job: J) -> Result<(), Error>
Expand description

Dispatch a job using the global queue.

In sync mode, the job executes immediately. In redis mode, it’s queued for background processing.

§Example

use cancer_queue::{dispatch, Job, Error};

#[derive(Debug, Serialize, Deserialize)]
struct MyJob { data: String }

impl Job for MyJob {
    async fn handle(&self) -> Result<(), Error> { Ok(()) }
}

dispatch(MyJob { data: "hello".into() }).await?;