BaseConsumer

Trait BaseConsumer 

Source
pub trait BaseConsumer<T>:
    Send
    + Sync
    + 'static
where T: DeserializeOwned + Send + Sync,
{ // Required method fn handle<'life0, 'async_trait>( &'life0 self, message: T, context: MessageContext, ) -> Pin<Box<dyn Future<Output = Result<(), ProcessingError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; }
Expand description

Base consumer trait for processing messages with smart retry handling

This trait provides a simplified interface where:

  • Messages are automatically ACK’d after successful processing
  • Retryable errors automatically publish to delay exchange
  • Non-retryable errors send to DLQ or discard based on configuration

Required Methods§

Source

fn handle<'life0, 'async_trait>( &'life0 self, message: T, context: MessageContext, ) -> Pin<Box<dyn Future<Output = Result<(), ProcessingError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Process a message and return the result

§Returns
  • Ok(()) - Message processed successfully, will be ACK’d automatically
  • Err(ProcessingError::Retryable { .. }) - Will retry with delay exchange
  • Err(ProcessingError::NonRetryable { .. }) - Will reject/send to DLQ

Implementors§