task_handler_async

Attribute Macro task_handler_async 

Source
#[task_handler_async]
Expand description

Attribute macro for registering asynchronous task handlers

This macro marks an async function as a task handler and stores metadata about it. The function signature and behavior remain unchanged.

§Arguments

  • pattern - The task type pattern to match (e.g., “email:send”, “image:resize”)

§Examples

use asynq_macros::task_handler_async;
use asynq::{task::Task, error::Result};

#[task_handler_async("image:resize")]
async fn handle_image_resize(task: Task) -> Result<()> {
    println!("Processing image resize task");
    Ok(())
}