use anyhow::Result;
use futures::stream::Stream;
pub trait MessageBroker: Clone + Send + Sync {
type Message: Send;
type Id: Send;
fn receiver(&self) -> impl Stream<Item = (Self::Id, Self::Message)> + Send;
fn publish(&self, message: Self::Message) -> impl Future<Output = Result<()>> + Send;
fn publish_batch(&self, message: Vec<Self::Message>)
-> impl Future<Output = Result<()>> + Send;
fn ack(&self, id: Self::Id) -> impl Future<Output = Result<()>> + Send;
fn nack(&self, id: Self::Id) -> impl Future<Output = Result<()>> + Send;
}