Skip to main content

Consumer

Trait Consumer 

Source
pub trait Consumer: Send + Sync {
    // Required methods
    fn start<'life0, 'async_trait>(
        &'life0 mut self,
        context: ConsumerContext,
    ) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn stop<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn concurrency_model(&self) -> ConcurrencyModel { ... }
}
Expand description

A Consumer receives messages from an external source and feeds them into the route.

Required Methods§

Source

fn start<'life0, 'async_trait>( &'life0 mut self, context: ConsumerContext, ) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Start consuming messages, sending them through the provided context.

Source

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

Stop consuming messages.

Provided Methods§

Source

fn concurrency_model(&self) -> ConcurrencyModel

Declares this consumer’s natural concurrency model.

The runtime uses this to decide whether to process exchanges sequentially or spawn per-exchange. Consumers that accept inbound connections (HTTP, WebSocket, Kafka) should override this to return ConcurrencyModel::Concurrent.

Default: Sequential.

Implementors§