JobDispatch

Trait JobDispatch 

Source
pub trait JobDispatch: Send + Sync {
    // Required method
    fn dispatch_by_name(
        &self,
        job_type: &str,
        args: Value,
    ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + '_>>;
}
Expand description

Trait for dispatching jobs from function contexts.

This trait allows mutation and action contexts to dispatch background jobs without directly depending on the runtime’s JobDispatcher.

Required Methods§

Source

fn dispatch_by_name( &self, job_type: &str, args: Value, ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + '_>>

Dispatch a job by its registered name.

§Arguments
  • job_type - The registered name of the job type
  • args - JSON-serialized arguments for the job
§Returns

The UUID of the dispatched job

Implementors§