Skip to main content

Module trigger

Module trigger 

Source
Expand description

Pluggable trigger sources for starting workflow runs.

A Trigger listens for external or internal signals and emits TriggerEvents through a TriggerSink. The runtime starts all registered triggers alongside the HTTP server and cron scheduler, and forwards their events to the configured handler.

Built-in triggers:

  • EventTrigger – reacts to internal domain events (workflow chaining).
  • NatsTrigger – consumes messages from a NATS JetStream subject (behind the trigger-nats feature flag).
  • PollingTrigger – periodically polls an external source via a PollingProbe and triggers when new data is detected. Built-in probes: HttpProbe (trigger-polling-http) and SqlProbe (trigger-polling-sql).

§Examples

use ironflow_runtime::trigger::{Trigger, TriggerSink, TriggerEvent};
use ironflow_runtime::trigger::event::{EventTrigger, EventTriggerRule};
use ironflow_store::entities::EventKind;

let trigger = EventTrigger::new(vec![
    EventTriggerRule {
        on_event: EventKind::RunFailed,
        source_workflow: "deploy".to_string(),
        target_workflow: "rollback".to_string(),
        max_chain_depth: 3,
        conditions: vec![],
    },
]);

Modules§

event
Domain-event trigger for workflow chaining.
polling
Polling trigger for external data sources.

Structs§

TriggerEvent
A request to create a workflow run, emitted by a Trigger.
TriggerSink
Channel endpoint for triggers to emit TriggerEvents.

Enums§

TriggerError
Error type for trigger operations.

Traits§

Trigger
A source of workflow run triggers.

Type Aliases§

TriggerFuture
Future returned by Trigger::start.