Skip to main content

QueueSource

Trait QueueSource 

Source
pub trait QueueSource: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn pull<'life0, 'async_trait>(
        &'life0 self,
        max_messages: usize,
        wait: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<QueueMessage>, AdkError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;
    fn ack<'life0, 'life1, 'async_trait>(
        &'life0 self,
        receipt: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn nack<'life0, 'life1, 'async_trait>(
        &'life0 self,
        receipt: &'life1 str,
        redeliver_after: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
}
Expand description

A pull-based, at-least-once message source.

Every implementation passes adk_core::queue_source_conformance_tests! (feature conformance).

Required Methods§

Source

fn name(&self) -> &str

A stable name for this source, used in idempotency keys and logs.

Source

fn pull<'life0, 'async_trait>( &'life0 self, max_messages: usize, wait: Duration, ) -> Pin<Box<dyn Future<Output = Result<Vec<QueueMessage>, AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Leases up to max_messages messages, waiting up to wait for the first one.

A leased message is not returned again until it is nacked or its lease lapses.

§Errors

Returns an error when the broker cannot be reached.

Source

fn ack<'life0, 'life1, 'async_trait>( &'life0 self, receipt: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Removes the message leased under receipt.

§Errors

Returns QUEUE_UNKNOWN_RECEIPT_CODE when the lease lapsed or the receipt is unknown; the message will be redelivered.

Source

fn nack<'life0, 'life1, 'async_trait>( &'life0 self, receipt: &'life1 str, redeliver_after: Duration, ) -> Pin<Box<dyn Future<Output = Result<(), AdkError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Returns the message leased under receipt for redelivery after redeliver_after.

§Errors

Same as ack.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§