Skip to main content

PollingConsumer

Trait PollingConsumer 

Source
pub trait PollingConsumer: Send + Sync {
    // Required method
    fn receive<'life0, 'async_trait>(
        &'life0 mut self,
        timeout: Duration,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Exchange>, CamelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

A polling consumer receives messages on demand (pull model) rather than being event-driven (push model).

Implement this trait on endpoints that support synchronous pull-based consumption (e.g., file, FTP, JMS). Components that are purely event-driven (e.g., HTTP server, Kafka) can leave the default Endpoint::polling_consumer returning None.

Required Methods§

Source

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

Receive the next available exchange within timeout, or None if none arrives. timeout = Duration::ZERO means non-blocking (return immediately if nothing pending).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§