pub struct JobQueue { /* private fields */ }Expand description
Main job queue manager
Implementations§
Source§impl JobQueue
impl JobQueue
Sourcepub fn new<B: JobBackend + 'static>(backend: B) -> Self
pub fn new<B: JobBackend + 'static>(backend: B) -> Self
Create a new job queue with a backend
Sourcepub async fn register_job<J: Job + Clone>(&self, job: J)
pub async fn register_job<J: Job + Clone>(&self, job: J)
Register a job handler
Sourcepub async fn enqueue_opts<J: Job>(
&self,
data: J::Data,
opts: EnqueueOptions,
) -> Result<String>
pub async fn enqueue_opts<J: Job>( &self, data: J::Data, opts: EnqueueOptions, ) -> Result<String>
Enqueue a job with options
Sourcepub async fn process_one(&self) -> Result<bool>
pub async fn process_one(&self) -> Result<bool>
Process a single job (for testing or manual control)
Sourcepub async fn start_worker(&self) -> Result<()>
pub async fn start_worker(&self) -> Result<()>
Start a worker loop
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JobQueue
impl !RefUnwindSafe for JobQueue
impl Send for JobQueue
impl Sync for JobQueue
impl Unpin for JobQueue
impl !UnwindSafe for JobQueue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more