mod config;
mod dispatcher;
mod error;
mod job;
mod queue;
mod worker;
pub use config::QueueConfig;
pub use dispatcher::{
dispatch, dispatch_later, dispatch_to, register_tenant_capture_hook, PendingDispatch,
};
pub use error::Error;
pub use job::{Job, JobPayload};
pub use queue::{
FailedJobInfo, JobInfo, JobState, Queue, QueueConnection, QueueStats, SingleQueueStats,
};
pub use worker::{TenantScopeProvider, Worker, WorkerConfig};
pub use async_trait::async_trait;
pub trait Queueable: Job + serde::Serialize + serde::de::DeserializeOwned {
fn dispatch(self) -> PendingDispatch<Self>
where
Self: Sized,
{
PendingDispatch::new(self)
}
fn delay(self, duration: std::time::Duration) -> PendingDispatch<Self>
where
Self: Sized,
{
PendingDispatch::new(self).delay(duration)
}
fn on_queue(self, queue: &'static str) -> PendingDispatch<Self>
where
Self: Sized,
{
PendingDispatch::new(self).on_queue(queue)
}
}
impl<T> Queueable for T where T: Job + serde::Serialize + serde::de::DeserializeOwned {}