workflow

Attribute Macro workflow 

Source
#[workflow]
Expand description

Marks a function as a durable workflow.

Workflows are multi-step processes that survive restarts and handle failures with compensation.

§Attributes

  • version = 1 - Workflow version (increment for breaking changes)
  • timeout = "24h" - Maximum execution time

§Example

#[forge::workflow]
#[version = 1]
pub async fn user_onboarding(ctx: &WorkflowContext, input: OnboardingInput) -> Result<OnboardingResult> {
    let user = ctx.step("create_user", || async { /* ... */ }).await?;
    ctx.step("send_welcome", || async { /* ... */ }).await;
    Ok(OnboardingResult { user })
}