pub trait AsyncFunctionHandler: Send + Sync {
// Required method
fn execute<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
message: &'life1 mut Message,
input: &'life2 Value,
data_logic: &'life3 mut DataLogic,
) -> Pin<Box<dyn Future<Output = Result<(usize, Vec<Change>)>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
}
Expand description
Thread-safe async interface for task functions that operate on messages
§Thread-Safety (v1.0)
Functions now receive a DataLogic instance as a parameter, enabling thread-safe JSONLogic evaluation without internal locking. Each message gets exclusive access to a DataLogic instance for its entire workflow execution.
§Usage
Implement this trait for custom async processing logic. The function receives:
- Mutable access to the message being processed
- Input parameters from the task configuration
- A DataLogic instance for JSONLogic evaluation
Perfect for IO-bound operations like HTTP requests, database queries, and file operations.