Skip to main content

CronService

Trait CronService 

Source
pub trait CronService: Send + Sync {
    // Required method
    fn run<'life0, 'life1, 'async_trait>(
        &'life0 self,
        schedule: &'life1 CronSchedule,
        callback: CronCallback,
        cancel: CancellationToken,
    ) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

SPI for cron-triggered scheduling backends.

The default implementation is TokioCronService (in camel-cron).

Required Methods§

Source

fn run<'life0, 'life1, 'async_trait>( &'life0 self, schedule: &'life1 CronSchedule, callback: CronCallback, cancel: CancellationToken, ) -> Pin<Box<dyn Future<Output = Result<(), CamelError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Run the scheduling loop until cancel is triggered or callback fails.

  • Clean cancellation -> return Ok(()).
  • Callback failure -> return Err(...) for ADR-0007 supervision.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§