Expand description
Polling trigger for external data sources.
PollingTrigger periodically executes a PollingProbe and emits a
TriggerEvent when the probe detects new data.
Optional deduplication prevents re-triggering when the probe result has
not changed since the last poll.
§Built-in probes
HttpProbe– polls an HTTP endpoint, triggers when the response body changes (behind thetrigger-polling-httpfeature flag).SqlProbe– executes a SQL query, triggers when the result set is non-empty (behind thetrigger-polling-sqlfeature flag).
§Custom probes
Implement PollingProbe to add your own data source:
use ironflow_runtime::trigger::polling::{PollingProbe, ProbeFuture, ProbeResult, ProbeError};
struct MyProbe;
impl PollingProbe for MyProbe {
fn name(&self) -> &str { "my-probe" }
fn poll(&self) -> ProbeFuture<'_> {
Box::pin(async {
Ok(Some(ProbeResult::new(serde_json::json!({"rows": 42}))))
})
}
}§Examples
use std::time::Duration;
use ironflow_runtime::trigger::polling::{
PollingTrigger, PollingTriggerConfig, PollingProbe, ProbeFuture, ProbeResult,
ProbeError,
};
struct StubProbe;
impl PollingProbe for StubProbe {
fn name(&self) -> &str { "stub" }
fn poll(&self) -> ProbeFuture<'_> {
Box::pin(async { Ok(Some(ProbeResult::new(serde_json::json!({"ok": true})))) })
}
}
let trigger = PollingTrigger::new(PollingTriggerConfig {
interval: Duration::from_secs(30),
probe: Box::new(StubProbe),
workflow_name: "ingest".to_string(),
dedup: true,
});Structs§
- Polling
Trigger - A trigger that periodically polls an external source.
- Polling
Trigger Config - Configuration for a
PollingTrigger. - Probe
Result - The result of a successful probe execution.
Enums§
- Probe
Error - Error type for probe operations.
Traits§
- Polling
Probe - A probe that checks an external data source for new data.
Type Aliases§
- Probe
Future - Future returned by
PollingProbe::poll.