pub struct MemoryQueue { /* private fields */ }Expand description
A process-local queue. Cloning shares one store, so it can be registered as application state and handed to every handler and worker.
Implementations§
Source§impl MemoryQueue
impl MemoryQueue
pub fn new() -> Self
Sourcepub fn ready_size(&self, queue: &str) -> Result<u64>
pub fn ready_size(&self, queue: &str) -> Result<u64>
How many jobs are ready to run right now, as opposed to Queue::size,
which counts delayed ones too. Useful for asserting in a test that a
delay is actually holding a job back.
Sourcepub fn flush_failed(&self) -> Result<u64>
pub fn flush_failed(&self) -> Result<u64>
Empty the dead-letter store. queue:flush in Laravel.
Trait Implementations§
Source§impl Clone for MemoryQueue
impl Clone for MemoryQueue
Source§impl Default for MemoryQueue
impl Default for MemoryQueue
Source§impl Queue for MemoryQueue
impl Queue for MemoryQueue
Source§fn driver(&self) -> &'static str
fn driver(&self) -> &'static str
The driver’s name. It appears in
queue.* events and error messages,
which is how Telescope shows which backend handled a job.Source§fn push(&self, job: QueuedJob) -> BoxFuture<'_, Result<String>>
fn push(&self, job: QueuedJob) -> BoxFuture<'_, Result<String>>
Store a job. Returns the driver’s identifier for it. Read more
Source§fn pop<'a>(
&'a self,
queue: &'a str,
) -> BoxFuture<'a, Result<Option<ReservedJob>>>
fn pop<'a>( &'a self, queue: &'a str, ) -> BoxFuture<'a, Result<Option<ReservedJob>>>
Reserve the next available job, or
None when there is nothing ready. Read moreSource§fn size<'a>(&'a self, queue: &'a str) -> BoxFuture<'a, Result<u64>>
fn size<'a>(&'a self, queue: &'a str) -> BoxFuture<'a, Result<u64>>
How many jobs are waiting on a queue, including delayed ones.
Source§fn delete<'a>(&'a self, _job: &'a ReservedJob) -> BoxFuture<'a, Result<()>>
fn delete<'a>(&'a self, _job: &'a ReservedJob) -> BoxFuture<'a, Result<()>>
Finish with a reserved job: it succeeded and is gone.
Source§fn release<'a>(
&'a self,
job: &'a ReservedJob,
delay: Duration,
) -> BoxFuture<'a, Result<()>>
fn release<'a>( &'a self, job: &'a ReservedJob, delay: Duration, ) -> BoxFuture<'a, Result<()>>
Put a reserved job back, available again after
delay. Read moreSource§fn fail<'a>(
&'a self,
job: &'a ReservedJob,
error: &'a str,
) -> BoxFuture<'a, Result<()>>
fn fail<'a>( &'a self, job: &'a ReservedJob, error: &'a str, ) -> BoxFuture<'a, Result<()>>
Move a reserved job to the dead-letter store with the error that killed
it. It must no longer be on the queue afterwards.
Source§fn failed_jobs(&self) -> BoxFuture<'_, Result<Vec<FailedJob>>>
fn failed_jobs(&self) -> BoxFuture<'_, Result<Vec<FailedJob>>>
Everything in the dead-letter store, oldest first.
Source§fn clear<'a>(&'a self, queue: &'a str) -> BoxFuture<'a, Result<u64>>
fn clear<'a>(&'a self, queue: &'a str) -> BoxFuture<'a, Result<u64>>
Throw away every job waiting on a queue. Returns how many went.
Auto Trait Implementations§
impl Freeze for MemoryQueue
impl RefUnwindSafe for MemoryQueue
impl Send for MemoryQueue
impl Sync for MemoryQueue
impl Unpin for MemoryQueue
impl UnsafeUnpin for MemoryQueue
impl UnwindSafe for MemoryQueue
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> QueueExt for T
impl<T> QueueExt for T
Source§fn dispatch_chain<'a>(&'a self, chain: Chain) -> BoxFuture<'a, Result<String>>
fn dispatch_chain<'a>(&'a self, chain: Chain) -> BoxFuture<'a, Result<String>>
dispatch(SendWelcomeEmail { user_id }) — the everyday call.
Push the first step of a chain; the worker pushes each next step as
the one before it succeeds. Returns the first step’s id.