Skip to main content

WorkflowDispatch

Trait WorkflowDispatch 

Source
pub trait WorkflowDispatch: Send + Sync {
    // Required methods
    fn get_info(&self, workflow_name: &str) -> Option<WorkflowInfo>;
    fn start_by_name(
        &self,
        workflow_name: &str,
        input: Value,
        owner_subject: Option<String>,
        trace_id: Option<String>,
    ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + '_>>;
    fn start_in_conn<'a>(
        &'a self,
        conn: &'a mut PgConnection,
        workflow_name: &'a str,
        input: Value,
        owner_subject: Option<String>,
        trace_id: Option<String>,
    ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + 'a>>;
}
Expand description

Trait for starting workflows from function contexts.

Required Methods§

Source

fn get_info(&self, workflow_name: &str) -> Option<WorkflowInfo>

Get workflow info by name for auth checking.

Source

fn start_by_name( &self, workflow_name: &str, input: Value, owner_subject: Option<String>, trace_id: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + '_>>

Start a workflow by its registered name.

trace_id is propagated onto the run row so observability links request → workflow.

Source

fn start_in_conn<'a>( &'a self, conn: &'a mut PgConnection, workflow_name: &'a str, input: Value, owner_subject: Option<String>, trace_id: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<Uuid>> + Send + 'a>>

Start a workflow on an existing connection — typically the live transaction inside a MutationContext. The run row and its $workflow_resume job are written in the same transaction so the worker only picks the run up after commit.

Implementors§