Skip to main content

AsyncStreamingHandler

Trait AsyncStreamingHandler 

Source
pub trait AsyncStreamingHandler: Send + Sync {
Show 14 methods // Required methods fn add_status_subscriber<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, subscriber: Box<dyn Subscriber<TaskStatusUpdateEvent> + Send + Sync>, ) -> Pin<Box<dyn Future<Output = Result<String, A2AError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn add_artifact_subscriber<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, subscriber: Box<dyn Subscriber<TaskArtifactUpdateEvent> + Send + Sync>, ) -> Pin<Box<dyn Future<Output = Result<String, A2AError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn remove_subscription<'life0, 'life1, 'async_trait>( &'life0 self, subscription_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn remove_task_subscribers<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_subscriber_count<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<usize, A2AError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn broadcast_status_update<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, update: TaskStatusUpdateEvent, ) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn broadcast_artifact_update<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, update: TaskArtifactUpdateEvent, ) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn status_update_stream<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<TaskStatusUpdateEvent, A2AError>> + Send>>, A2AError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn artifact_update_stream<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<TaskArtifactUpdateEvent, A2AError>> + Send>>, A2AError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn combined_update_stream<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<UpdateEvent, A2AError>> + Send>>, A2AError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; // Provided methods fn has_subscribers<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, A2AError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn validate_streaming_params<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn start_task_streaming<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<UpdateEvent, A2AError>> + Send>>, A2AError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn stop_task_streaming<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... }
}
Expand description

An async trait for managing streaming connections and real-time updates

Required Methods§

Source

fn add_status_subscriber<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, subscriber: Box<dyn Subscriber<TaskStatusUpdateEvent> + Send + Sync>, ) -> Pin<Box<dyn Future<Output = Result<String, A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Add a status update subscriber for a task

Source

fn add_artifact_subscriber<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, subscriber: Box<dyn Subscriber<TaskArtifactUpdateEvent> + Send + Sync>, ) -> Pin<Box<dyn Future<Output = Result<String, A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Add an artifact update subscriber for a task

Source

fn remove_subscription<'life0, 'life1, 'async_trait>( &'life0 self, subscription_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove a specific subscription

Source

fn remove_task_subscribers<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove all subscribers for a task

Source

fn get_subscriber_count<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<usize, A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the number of active subscribers for a task

Source

fn broadcast_status_update<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, update: TaskStatusUpdateEvent, ) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Broadcast a status update to all subscribers of a task

Source

fn broadcast_artifact_update<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, update: TaskArtifactUpdateEvent, ) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Broadcast an artifact update to all subscribers of a task

Source

fn status_update_stream<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<TaskStatusUpdateEvent, A2AError>> + Send>>, A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a stream of status updates for a task

Source

fn artifact_update_stream<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<TaskArtifactUpdateEvent, A2AError>> + Send>>, A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a stream of artifact updates for a task

Source

fn combined_update_stream<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<UpdateEvent, A2AError>> + Send>>, A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create a combined stream of all updates for a task

Provided Methods§

Source

fn has_subscribers<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Check if a task has any active subscribers

Source

fn validate_streaming_params<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Validate streaming parameters

Source

fn start_task_streaming<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<UpdateEvent, A2AError>> + Send>>, A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Start streaming for a task with automatic cleanup

Source

fn stop_task_streaming<'life0, 'life1, 'async_trait>( &'life0 self, task_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), A2AError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Stop all streaming for a task

Implementors§