azums_core/backend/
stream.rs1use crate::{
2 backend::NotificationStream,
3 model::{ConsumerGroupStatus, Event, NewEvent},
4};
5use async_trait::async_trait;
6
7#[async_trait]
9pub trait StreamBackend: Send + Sync {
10 async fn publish(&self, stream: &str, event: NewEvent) -> anyhow::Result<i64>;
12
13 async fn subscribe_stream(
15 &self,
16 stream: &str,
17 consumer_group: &str,
18 last_seq: Option<i64>,
19 ) -> anyhow::Result<NotificationStream>;
20
21 async fn ack(&self, stream: &str, consumer_group: &str, seq: i64) -> anyhow::Result<()>;
23
24 async fn read_events(
26 &self,
27 stream: &str,
28 after_seq: i64,
29 limit: i64,
30 ) -> anyhow::Result<Vec<Event>>;
31
32 async fn consumer_group_info(&self, stream: &str) -> anyhow::Result<Vec<ConsumerGroupStatus>>;
34}