Skip to main content

workflow

Attribute Macro workflow 

Source
#[workflow]
Expand description

Define a workflow as a module containing #[task] functions.

Applied to a pub mod containing #[task] functions. Auto-discovers tasks, validates dependencies, and generates registration code based on delivery mode:

  • Embedded (default): inventory::submit! auto-registration consumed by cloacina::Runtime::seed_from_inventory
  • Packaged (features = ["packaged"]): FFI exports for .cloacina packages

§Example

#[workflow(name = "my_pipeline", description = "Process data")]
pub mod my_pipeline {
    use super::*;

    #[task(id = "fetch", dependencies = [])]
    pub async fn fetch(ctx: &mut Context<Value>) -> Result<(), TaskError> { Ok(()) }

    #[task(id = "process", dependencies = ["fetch"])]
    pub async fn process(ctx: &mut Context<Value>) -> Result<(), TaskError> { Ok(()) }
}