pub struct ProcessDefinition {Show 14 fields
pub uuid: Option<Uuid>,
pub key: IdField,
pub name: String,
pub version: VersionId,
pub status: ProcessStatus,
pub effective_from: Option<DateTime<Utc>>,
pub deprecated_at: Option<DateTime<Utc>>,
pub metadata: ProcessMetadata,
pub signals: Vec<SignalDef>,
pub forms: Vec<FormDef>,
pub stages: Vec<StageDef>,
pub special_handlers: Option<SpecialHandlers>,
pub escalations: Vec<EscalationDef>,
pub nodes: Vec<Node>,
}Expand description
A versioned workflow definition with declarations and executable nodes.
§Examples
use fluxpro_engine::models::process_def::ProcessDefinition;
let definition: ProcessDefinition = serde_json::from_value(serde_json::json!({
"key": "demo", "name": "Demo", "version": "1.0.0", "status": "active",
"effective_from": "2026-01-01T00:00:00Z",
"stages": [{ "id": "created", "name": "Created", "is_initial": true }],
"nodes": [
{ "id": "start", "type": "Start", "next": "done" },
{ "id": "done", "type": "End" }
]
})).unwrap();
assert!(definition.validate().is_ok());
assert_eq!(definition.compile().unwrap()["nodes"][0]["type"], "Start");Fields§
§uuid: Option<Uuid>Database identity; skipped in JSON/YAML and assigned after persistence.
key: IdFieldLogical process key shared by all versions of this workflow.
name: StringHuman-readable process name.
version: VersionIdNormalized process definition version.
status: ProcessStatusOnly active definitions within their effective dates may start new instances.
effective_from: Option<DateTime<Utc>>UTC time from which this definition can be selected.
deprecated_at: Option<DateTime<Utc>>UTC time after which this definition is excluded from runtime selection.
metadata: ProcessMetadataOptional ownership, SLA, and version notes.
signals: Vec<SignalDef>Signal declarations available to the workflow.
forms: Vec<FormDef>Forms declared for user-task lifecycle hooks.
stages: Vec<StageDef>Business stages; runtime startup requires an initial stage.
special_handlers: Option<SpecialHandlers>Optional callbacks invoked during stage, form, and completion events.
escalations: Vec<EscalationDef>Operator escalation topics and available actions.
nodes: Vec<Node>Workflow graph; exactly one Start and at least one End are required.
Implementations§
Source§impl ProcessDefinition
impl ProcessDefinition
Sourcepub fn compile(&self) -> Result<JsonValue, CreateProcessError>
pub fn compile(&self) -> Result<JsonValue, CreateProcessError>
Validates references and serializes this definition to JSON.
§Errors
Returns structural failures and, with runtime, condition compilation errors.
Sourcepub fn validate(&self) -> Result<(), CreateProcessError>
pub fn validate(&self) -> Result<(), CreateProcessError>
Checks unique IDs, start/end presence, references, and service retry settings.
§Errors
Returns accumulated validation messages, including initial stages and timers.
With runtime, also compiles conditions. Handler registration is host-owned.
Use unreachable_nodes for reachability diagnostics.
Sourcepub fn unreachable_nodes(&self) -> Vec<IdField>
pub fn unreachable_nodes(&self) -> Vec<IdField>
Lists nodes with no structural path from Start, in definition order.
This is diagnostic rather than a registration error because hosts may explicitly enqueue auxiliary nodes. Conditions are not evaluated.
Trait Implementations§
Source§impl Clone for ProcessDefinition
impl Clone for ProcessDefinition
Source§fn clone(&self) -> ProcessDefinition
fn clone(&self) -> ProcessDefinition
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more