1use crate::{error::Result, exchange::Exchange, processor::Processor};
7use async_trait::async_trait;
8use std::sync::Arc;
9
10#[async_trait]
12pub trait Producer: Send + Sync {
13 async fn send(&self, exchange: &mut Exchange) -> Result<()>;
14}
15
16#[async_trait]
20pub trait Consumer: Send + Sync {
21 async fn start(&self) -> Result<()>;
22 async fn stop(&self) -> Result<()>;
23}
24
25#[async_trait]
27pub trait Endpoint: Send + Sync {
28 fn uri(&self) -> &str;
29 async fn create_producer(&self) -> Result<Arc<dyn Producer>>;
30 async fn create_consumer(&self, pipeline: Arc<dyn Processor>) -> Result<Arc<dyn Consumer>>;
31}