job

Attribute Macro job 

Source
#[job]
Expand description

Marks a function as a background job.

Jobs are durable background tasks that survive server restarts and automatically retry on failure.

§Attributes

  • timeout = "30m" - Job timeout
  • priority = "normal" - background, low, normal, high, critical
  • max_attempts = 3 - Maximum retry attempts
  • worker_capability = "general" - Required worker capability

§Example

#[forge::job]
#[timeout = "30m"]
#[priority = "high"]
pub async fn send_welcome_email(ctx: &JobContext, input: SendEmailInput) -> Result<()> {
    // ...
}