Trait QueueHandle

Source
pub trait QueueHandle: Clone {
    type Acker: Acker;
    type Consumer<T: Serializable>: Stream<Item = (T, Self::Acker)>;
    type Publisher<T: Serializable>: Publisher<T>;

    // Required methods
    fn publisher<PayloadTarget: Serializable>(
        &self,
    ) -> Self::Publisher<PayloadTarget>;
    fn declare_consumer<'life0, 'life1, 'async_trait, PayloadTarget>(
        &'life0 self,
        consumer_name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Self::Consumer<PayloadTarget>>> + Send + 'async_trait>>
       where PayloadTarget: 'async_trait + Serializable,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided method
    fn publish<'life0, 'life1, 'async_trait, PayloadTarget>(
        &'life0 self,
        payload: &'life1 PayloadTarget,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self::Publisher<PayloadTarget>: Send,
             PayloadTarget: 'async_trait + Serializable,
             Self: Sync + 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

A handle to a queue.

Handles should be cheap to clone such that references need not be passed around.

Required Associated Types§

Required Methods§

Source

fn publisher<PayloadTarget: Serializable>( &self, ) -> Self::Publisher<PayloadTarget>

Source

fn declare_consumer<'life0, 'life1, 'async_trait, PayloadTarget>( &'life0 self, consumer_name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Self::Consumer<PayloadTarget>>> + Send + 'async_trait>>
where PayloadTarget: 'async_trait + Serializable, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Declare a queue consumer.

Provided Methods§

Source

fn publish<'life0, 'life1, 'async_trait, PayloadTarget>( &'life0 self, payload: &'life1 PayloadTarget, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self::Publisher<PayloadTarget>: Send, PayloadTarget: 'async_trait + Serializable, Self: Sync + 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl QueueHandle for AMQPQueueHandle

Source§

type Acker = AMQPAcker

Source§

type Consumer<PayloadTarget: Serializable> = AMQPConsumer<PayloadTarget>

Source§

type Publisher<PayloadTarget: Serializable> = AMQPPublisher<PayloadTarget>

Source§

impl QueueHandle for InMemoryQueueHandle

Source§

type Acker = NoopAcker

Source§

type Consumer<PayloadTarget: Serializable> = InMemoryConsumer<PayloadTarget>

Source§

type Publisher<PayloadTarget: Serializable> = InMemoryPublisher<PayloadTarget>