pub trait OutboxStore:
Send
+ Sync
+ Debug {
// Required methods
fn enqueue<'life0, 'async_trait>(
&'life0 self,
record: OutboxRecord,
) -> Pin<Box<dyn Future<Output = Result<(), EventError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn claim_pending<'life0, 'life1, 'async_trait>(
&'life0 self,
worker_id: &'life1 str,
limit: usize,
claim_expires_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Vec<OutboxRecord>, EventError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn claim_event<'life0, 'life1, 'async_trait>(
&'life0 self,
event_id: Uuid,
worker_id: &'life1 str,
claim_expires_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Option<OutboxRecord>, EventError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn mark_published<'life0, 'life1, 'async_trait>(
&'life0 self,
event_id: Uuid,
worker_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), EventError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn mark_failed<'life0, 'life1, 'async_trait>(
&'life0 self,
event_id: Uuid,
worker_id: &'life1 str,
error: String,
retry_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), EventError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn recover_expired_claims<'life0, 'async_trait>(
&'life0 self,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<usize, EventError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Persistence boundary for a transactional outbox.
Implementations must claim records atomically. Reading pending rows and updating them in a second statement is not a conforming implementation because multiple workers could publish the same event concurrently.
Required Methods§
fn enqueue<'life0, 'async_trait>(
&'life0 self,
record: OutboxRecord,
) -> Pin<Box<dyn Future<Output = Result<(), EventError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn claim_pending<'life0, 'life1, 'async_trait>(
&'life0 self,
worker_id: &'life1 str,
limit: usize,
claim_expires_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Vec<OutboxRecord>, EventError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn claim_event<'life0, 'life1, 'async_trait>(
&'life0 self,
event_id: Uuid,
worker_id: &'life1 str,
claim_expires_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Option<OutboxRecord>, EventError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn claim_event<'life0, 'life1, 'async_trait>(
&'life0 self,
event_id: Uuid,
worker_id: &'life1 str,
claim_expires_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<Option<OutboxRecord>, EventError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically claims one known event for request-assisted publication.
fn mark_published<'life0, 'life1, 'async_trait>(
&'life0 self,
event_id: Uuid,
worker_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), EventError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn mark_failed<'life0, 'life1, 'async_trait>(
&'life0 self,
event_id: Uuid,
worker_id: &'life1 str,
error: String,
retry_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<(), EventError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn recover_expired_claims<'life0, 'async_trait>(
&'life0 self,
now: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = Result<usize, EventError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".