Skip to main content

IdempotencyStore

Trait IdempotencyStore 

Source
pub trait IdempotencyStore: Send + Sync {
    // Required methods
    fn try_claim<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 MessageId,
        ttl: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<ClaimOutcome, BusError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn mark_done<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 MessageId,
    ) -> Pin<Box<dyn Future<Output = Result<(), BusError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn release<'life0, 'life1, 'async_trait>(
        &'life0 self,
        key: &'life1 MessageId,
    ) -> Pin<Box<dyn Future<Output = Result<(), BusError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Backend-agnostic idempotency store for deduplicating handler executions.

Implementations must use atomic operations to remain safe under concurrent delivery.

Required Methods§

Source

fn try_claim<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 MessageId, ttl: Duration, ) -> Pin<Box<dyn Future<Output = Result<ClaimOutcome, BusError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

State-aware claim. Atomically inserts the key in pending state if absent, otherwise reports the existing state.

Source

fn mark_done<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 MessageId, ) -> Pin<Box<dyn Future<Output = Result<(), BusError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Mark a previously claimed key as successfully processed.

Source

fn release<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 MessageId, ) -> Pin<Box<dyn Future<Output = Result<(), BusError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Release a pending claim so the message can be retried.

Implementors§