use anyhow::Result;
use async_trait::async_trait;
use bytes::Bytes;
use futures::Stream;
use std::pin::Pin;
use crate::discovery::EventTransportKind;
pub type WireStream = Pin<Box<dyn Stream<Item = Result<Bytes>> + Send>>;
#[async_trait]
pub trait EventTransportTx: Send + Sync {
async fn publish(&self, subject: &str, envelope_bytes: Bytes) -> Result<()>;
fn kind(&self) -> EventTransportKind;
}
#[async_trait]
pub trait EventTransportRx: Send + Sync {
async fn subscribe(&self, subject: &str) -> Result<WireStream>;
fn kind(&self) -> EventTransportKind;
}