use crate::{error::Result, exchange::Exchange, processor::Processor};
use async_trait::async_trait;
use std::sync::Arc;
#[async_trait]
pub trait Producer: Send + Sync {
async fn send(&self, exchange: &mut Exchange) -> Result<()>;
}
#[async_trait]
pub trait Consumer: Send + Sync {
async fn start(&self) -> Result<()>;
async fn stop(&self) -> Result<()>;
}
#[async_trait]
pub trait Endpoint: Send + Sync {
fn uri(&self) -> &str;
async fn create_producer(&self) -> Result<Arc<dyn Producer>>;
async fn create_consumer(&self, pipeline: Arc<dyn Processor>) -> Result<Arc<dyn Consumer>>;
}