Skip to main content

CollaborationTransport

Trait CollaborationTransport 

Source
pub trait CollaborationTransport: Send + Sync {
    // Required methods
    fn publish<'life0, 'async_trait>(
        &'life0 self,
        event: CollaborationEvent,
    ) -> Pin<Box<dyn Future<Output = Result<(), ExecutionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn subscribe(&self) -> Box<dyn CollaborationReceiver>;
}
Expand description

Async trait abstracting the collaboration event transport layer.

Implementations can be local (in-process broadcast) or remote (A2A over HTTP/SSE). The trait is intentionally minimal — publish and subscribe — so that higher-level semantics (correlation, wait/resume) stay in Workspace.

§Example

use adk_code::a2a_compat::{CollaborationTransport, LocalTransport};
use adk_code::{CollaborationEvent, CollaborationEventKind};

let transport = LocalTransport::new(64);
let event = CollaborationEvent::new(
    "c1", "topic", "agent", CollaborationEventKind::NeedWork,
);
transport.publish(event).await.unwrap();

Required Methods§

Source

fn publish<'life0, 'async_trait>( &'life0 self, event: CollaborationEvent, ) -> Pin<Box<dyn Future<Output = Result<(), ExecutionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Publish a collaboration event to all subscribers.

Source

fn subscribe(&self) -> Box<dyn CollaborationReceiver>

Create a new receiver for collaboration events.

Implementors§