Skip to main content

workflow

Attribute Macro workflow 

Source
#[workflow]
Expand description

Marks a function as a durable workflow.

If the function has a single parameter ctx: Ctx, it is automatically registered for crash recovery via inventory. When durable::init() recovers a stale task whose name matches this function, it will be re-spawned automatically.

#[durable::workflow]
async fn daily_etl(ctx: Ctx) -> Result<EtlReport, DurableError> {
    let data = ctx.step("extract", || async { fetch().await }).await?;
    ctx.complete(&data).await?;
    Ok(data)
}