general_mq::queue

Trait Message

Source
pub trait Message: Send + Sync {
    // Required methods
    fn payload(&self) -> &[u8] ;
    fn ack<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn nack<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError + Send + Sync>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

The operations for incoming messages.

Required Methods§

Source

fn payload(&self) -> &[u8]

To get the payload.

Source

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

Use this if the message is processed successfully.

Source

fn nack<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), Box<dyn StdError + Send + Sync>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

To requeue the message and the broker will send the message in the future.

Note: only AMQP or protocols that support requeuing are effective.

Implementors§