pub struct Workflow {Show 14 fields
pub id: String,
pub name: String,
pub priority: u32,
pub description: Option<String>,
pub condition: Value,
pub tasks: Vec<Task>,
pub continue_on_error: bool,
pub channel: String,
pub version: u32,
pub status: WorkflowStatus,
pub rollout: Option<Rollout>,
pub tags: Vec<String>,
pub created_at: Option<DateTime<Utc>>,
pub updated_at: Option<DateTime<Utc>>,
/* private fields */
}Expand description
Workflow represents a collection of tasks that execute sequentially (also known as a Rule in rules-engine terminology).
Conditions are evaluated against the full message context, including data, metadata, and temp_data fields.
Fields§
§id: String§name: String§priority: u32§description: Option<String>§condition: Value§tasks: Vec<Task>§continue_on_error: bool§channel: StringChannel for routing (default: “default”)
version: u32Version number for rule versioning (default: 1)
status: WorkflowStatusWorkflow status — Active, Paused, or Archived (default: Active)
rollout: Option<Rollout>Traffic split for this workflow. None (the default) means the workflow
is not part of a split and runs for every message.
A workflow with a rollout is skipped when the message’s
crate::Message::routing_bucket falls outside the range. A message with
no bucket is admitted — see Rollout.
Tags for categorization and filtering
created_at: Option<DateTime<Utc>>Creation timestamp
updated_at: Option<DateTime<Utc>>Last update timestamp
Implementations§
Source§impl Workflow
impl Workflow
pub fn new() -> Self
Sourcepub fn rule(id: &str, name: &str, condition: Value, tasks: Vec<Task>) -> Self
pub fn rule(id: &str, name: &str, condition: Value, tasks: Vec<Task>) -> Self
Create a workflow (rule) with a condition and tasks.
This is a convenience constructor for the IFTTT-style rules engine pattern:
IF condition THEN execute tasks.
§Arguments
id- Unique identifier for the rulename- Human-readable namecondition- JSONLogic condition evaluated against the full context (data, metadata, temp_data)tasks- Actions to execute when the condition is met
Source§impl Workflow
impl Workflow
Sourcepub fn connector_refs(&self) -> impl Iterator<Item = ConnectorRef<'_>>
pub fn connector_refs(&self) -> impl Iterator<Item = ConnectorRef<'_>>
Every connector reference in this workflow, in task order.
Tasks whose function names no connector are skipped. One item is yielded per task, not per distinct connector: two tasks on the same connector yield two items. Callers wanting a distinct set collect one themselves.
Does not require a compiled workflow — this reads only deserialized
fields, so it works on the output of Workflow::from_json before the
engine has compiled it.
Which configs carry a connector is this crate’s fact; deriving it here rather than reimplementing the set downstream is the point.