pub struct Queue { /* private fields */ }Expand description
Implementations§
Source§impl Queue
impl Queue
Sourcepub fn enqueue<J: Serialize>(
&self,
job: &J,
) -> impl Future<Output = Result<()>> + Send + use<J>
pub fn enqueue<J: Serialize>( &self, job: &J, ) -> impl Future<Output = Result<()>> + Send + use<J>
Sends job to this queue, like enqueue does to default.
§Errors
Those of enqueue; a missing binding names
the fix, ocre g job <Name> --queue <name>, and a queue name that is
not lowercase letters, digits and - is an
Error::Internal.
§Examples
ocre::jobs::queue(ctx, "urgent").enqueue(&serde_json::json!({"send_code": {"user_id": 1}})).await?;Sourcepub fn enqueue_in<J: Serialize>(
&self,
job: &J,
delay: Duration,
) -> impl Future<Output = Result<()>> + Send + use<J>
pub fn enqueue_in<J: Serialize>( &self, job: &J, delay: Duration, ) -> impl Future<Output = Result<()>> + Send + use<J>
Sends job to this queue, to run after delay (24 hours at most), like enqueue_in.
§Errors
Those of enqueue_in and Queue::enqueue.
§Examples
let later = std::time::Duration::from_secs(60);
ocre::jobs::queue(ctx, "urgent").enqueue_in(&"retry_payment", later).await?;Sourcepub fn enqueue_all<J: Serialize>(
&self,
jobs: &[J],
) -> impl Future<Output = Result<()>> + Send + use<J>
pub fn enqueue_all<J: Serialize>( &self, jobs: &[J], ) -> impl Future<Output = Result<()>> + Send + use<J>
Sends every job of jobs to this queue in batches, like enqueue_all.
§Errors
Those of enqueue_all and Queue::enqueue.
§Examples
ocre::jobs::queue(ctx, "urgent").enqueue_all(&["a", "b"]).await?;Trait Implementations§
Auto Trait Implementations§
impl Freeze for Queue
impl RefUnwindSafe for Queue
impl Send for Queue
impl Sync for Queue
impl Unpin for Queue
impl UnsafeUnpin for Queue
impl UnwindSafe 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