pub trait AsyncFunctionHandler: Send + Sync {
// Required method
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 mut Message,
config: &'life2 FunctionConfig,
datalogic: Arc<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;
}Expand description
Async interface for task functions that operate on messages
§Usage
Implement this trait for custom processing logic. The function receives:
- Mutable access to the message being processed (no cloning needed!)
- Pre-parsed function configuration
- Reference to the DataLogic instance for JSONLogic evaluation
§Performance Note
This trait works directly with &mut Message without any cloning.
The message is passed by mutable reference throughout the async execution,
ensuring zero-copy operation for optimal performance.
Required Methods§
Sourcefn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 mut Message,
config: &'life2 FunctionConfig,
datalogic: Arc<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,
fn execute<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
message: &'life1 mut Message,
config: &'life2 FunctionConfig,
datalogic: Arc<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,
Execute the function on a message with pre-parsed configuration
§Arguments
message- The message to process (mutable reference, no cloning)config- Pre-parsed function configurationdatalogic- Reference to DataLogic instance for JSONLogic evaluation
§Returns
Result<(usize, Vec<Change>)>- Result containing status code and changes, or error