Skip to main content

TaskHandler

Trait TaskHandler 

Source
pub trait TaskHandler: Send + Sync {
    // Required method
    fn handle<'life0, 'async_trait>(
        &'life0 self,
        task_id: String,
        message: Message,
        store: Arc<dyn TaskStore>,
    ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
}
Expand description

User-provided handler that processes an incoming message for a task.

Implementations are spawned in a background tokio::spawn and receive an Arc<dyn TaskStore> to update status and add artifacts as they work.

Required Methods§

Source

fn handle<'life0, 'async_trait>( &'life0 self, task_id: String, message: Message, store: Arc<dyn TaskStore>, ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§