pub struct Queue { /* private fields */ }Expand description
Queue for managing jobs
Implementations§
Source§impl Queue
impl Queue
Sourcepub fn new(backend: Arc<dyn QueueBackend>) -> Self
pub fn new(backend: Arc<dyn QueueBackend>) -> Self
Create a new queue with the given backend
Sourcepub async fn enqueue(&self, job: JobWrapper) -> Result<String>
pub async fn enqueue(&self, job: JobWrapper) -> Result<String>
Enqueue a job and return its ID
Sourcepub async fn dequeue(&self) -> Result<Option<JobWrapper>>
pub async fn dequeue(&self) -> Result<Option<JobWrapper>>
Dequeue the next available job
Sourcepub async fn retry(&self, job: JobWrapper) -> Result<()>
pub async fn retry(&self, job: JobWrapper) -> Result<()>
Retry a job
Sourcepub async fn move_to_dead_letter(&self, job: JobWrapper) -> Result<()>
pub async fn move_to_dead_letter(&self, job: JobWrapper) -> Result<()>
Move a job to the dead letter queue
Sourcepub async fn list_dead_letter(&self) -> Result<Vec<JobWrapper>>
pub async fn list_dead_letter(&self) -> Result<Vec<JobWrapper>>
List jobs in the dead letter queue
Sourcepub async fn retry_from_dead_letter(&self, job_id: &str) -> Result<()>
pub async fn retry_from_dead_letter(&self, job_id: &str) -> Result<()>
Retry a job from the dead letter queue
Sourcepub async fn get_stats(&self) -> QueueStats
pub async fn get_stats(&self) -> QueueStats
Get current queue statistics
Auto Trait Implementations§
impl !RefUnwindSafe for Queue
impl !UnwindSafe for Queue
impl Freeze for Queue
impl Send for Queue
impl Sync for Queue
impl Unpin for Queue
impl UnsafeUnpin for Queue
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more