Skip to main content

PollingProbe

Trait PollingProbe 

Source
pub trait PollingProbe: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn poll(&self) -> ProbeFuture<'_>;
}
Expand description

A probe that checks an external data source for new data.

Implementations are called periodically by PollingTrigger. The probe returns Some(ProbeResult) when data is found, or None when the source has nothing to report (e.g. a SQL query returned zero rows).

§Examples

use ironflow_runtime::trigger::polling::{PollingProbe, ProbeFuture, ProbeResult, ProbeError};

struct AlwaysNewProbe;

impl PollingProbe for AlwaysNewProbe {
    fn name(&self) -> &str { "always-new" }

    fn poll(&self) -> ProbeFuture<'_> {
        Box::pin(async {
            Ok(Some(ProbeResult::new(serde_json::json!({"data": "fresh"}))))
        })
    }
}

Required Methods§

Source

fn name(&self) -> &str

Human-readable name for logging and metrics.

Source

fn poll(&self) -> ProbeFuture<'_>

Execute the probe and return the result.

§Errors

Returns ProbeError if the probe cannot reach the data source or encounters an unrecoverable error.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§