forgex 0.10.2

CLI and runtime for the Forge full-stack framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
// Context API: ctx.heartbeat(), ctx.progress(...), ctx.cancellation_requested(), ctx.saved_data().
// Dispatch from a transactional mutation: ctx.dispatch_job::<{{Name}}Job>(args).

use forge::prelude::*;

#[forge::job(retry(max_attempts = 5, base_delay = "1s"), timeout = "5m")]
pub async fn {{name}}(ctx: &JobContext, args: serde_json::Value) -> Result<()> {
    ctx.heartbeat().await?;
    // TODO: do work; call ctx.heartbeat().await? periodically for long jobs
    let _ = args;
    Ok(())
}