Skip to main content

JobConsumer

Trait JobConsumer 

Source
pub trait JobConsumer:
    Send
    + Sync
    + 'static {
    // Required method
    fn run<'async_trait>(
        self: Box<Self>,
        methods: Vec<&'static ProcessMethod>,
        container: Container,
        cancel: CancellationToken,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Expand description

Drains a list of #[process] methods until cancellation. One per app — the Transport a queue backend contributes typically wraps a JobConsumer and forwards the cancellation token.

Required Methods§

Source

fn run<'async_trait>( self: Box<Self>, methods: Vec<&'static ProcessMethod>, container: Container, cancel: CancellationToken, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,

Run the consumer loop. methods is the access-graph-filtered set of process methods this backend is responsible for; container resolves the providers each handler dispatches into; cancel triggers graceful shutdown.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§