bpm_engine_storage/
event_store.rs1use async_trait::async_trait;
2
3#[derive(Debug, Clone)]
4pub struct OutboxEvent {
5 pub id: String,
6 pub event_type: String,
7 pub payload: String,
8 pub status: String,
9 pub tenant_id: Option<String>,
10 pub created_at: Option<String>,
11}
12
13#[async_trait]
14pub trait OutboxRepo: Send + Sync {
15 async fn insert_pending(
16 &self,
17 tenant_id: Option<&str>,
18 event_type: &str,
19 payload: &str,
20 ) -> anyhow::Result<String>;
21 async fn list_pending(&self, tenant_id: Option<&str>) -> anyhow::Result<Vec<OutboxEvent>>;
22 async fn mark_published(&self, id: &str) -> anyhow::Result<()>;
23 async fn claim_pending(
24 &self,
25 worker_id: &str,
26 tenant_id: Option<&str>,
27 limit: u32,
28 ) -> anyhow::Result<Vec<OutboxEvent>>;
29 async fn release_claimed(&self, id: &str) -> anyhow::Result<()>;
30}