Skip to main content

WorkflowHandler

Trait WorkflowHandler 

Source
pub trait WorkflowHandler: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn execute<'a>(&'a self, ctx: &'a mut WorkflowContext) -> HandlerFuture<'a>;

    // Provided methods
    fn category(&self) -> Option<&str> { ... }
    fn describe(&self) -> WorkflowInfo { ... }
}
Expand description

A dynamic workflow handler with context-aware step chaining.

Implement this trait to define workflows where each step can use the output of previous steps. Register handlers with Engine::register and execute them by name.

§Why Pin<Box<dyn Future>> instead of async fn?

The handler must be object-safe (dyn WorkflowHandler) to allow registering different handler types in the engine’s registry.

Required Methods§

Source

fn name(&self) -> &str

The workflow name used for registration and lookup.

Source

fn execute<'a>(&'a self, ctx: &'a mut WorkflowContext) -> HandlerFuture<'a>

Execute the workflow with the given context.

The context provides shell, http, and agent methods that automatically persist each step.

§Errors

Return EngineError if any step fails. The engine will mark the run as Failed and record the error.

Provided Methods§

Source

fn category(&self) -> Option<&str>

Optional /-separated category path used to group workflows in the UI tree.

Return a value like "data/etl" to place the workflow under dataetl. The default is None (uncategorized).

Validation (empty segments, leading or trailing /, //, whitespace segments) is enforced at registration time by Engine::register.

Source

fn describe(&self) -> WorkflowInfo

Return metadata about this workflow (description, source code).

Override this to provide a description and source code for the dashboard UI. The default returns an empty description with no source but propagates WorkflowHandler::category.

Implementors§