Skip to main content

appletheia_application/messaging/
topic.rs

1use super::{Consumer, ConsumerGroup, Publisher, Subscription, TopicError};
2
3#[allow(async_fn_in_trait)]
4pub trait Topic<M>: Send {
5    type Consumer: Consumer<M>;
6    type Publisher: Publisher<M>;
7    type Selector;
8
9    fn new_publisher(&self) -> Self::Publisher;
10
11    async fn subscribe(
12        &mut self,
13        consumer_group: &ConsumerGroup,
14        subscription: Subscription<'_, Self::Selector>,
15    ) -> Result<Self::Consumer, TopicError>;
16}