pub trait QueueJobRepository: Send + Sync {
type Error;
// Required method
fn schedule<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
queue_name: &'life3 str,
payload: Value,
metadata: Value,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
}
Expand description
A QueueJobRepository
is used to schedule jobs to be executed by a
worker.
Required Associated Types§
Required Methods§
sourcefn schedule<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
queue_name: &'life3 str,
payload: Value,
metadata: Value,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn schedule<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
queue_name: &'life3 str,
payload: Value,
metadata: Value,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Schedule a job to be executed as soon as possible by a worker.
§Parameters
rng
- The random number generator used to generate a new job IDclock
- The clock used to generate timestampsqueue_name
- The name of the queue to schedule the job onpayload
- The payload of the jobmetadata
- Arbitrary metadata about the job scheduled immediately.
§Errors
Returns an error if the underlying repository fails.