Skip to content

Node Types Overview

The Vyuh Workflow Engine provides a rich vocabulary of node types for modeling any business process.

Node Type Summary

TypeBuilder MethodDescription
Start.start()Entry point for workflow
End.end()Terminal point
Task.task()Automated work execution
User Task.userTask()Human task (inbox item)
Signal Wait.signalWait()Wait for external signal
Timer EventWait for duration or date/time
SubflowInvoke a child workflow
ForEach LoopIterate over a collection
While LoopRepeat while condition is true
Exclusive Gateway.oneOf()Route to ONE path (XOR)
Race Gateway.anyOf()Race paths, first wins (OR)
Parallel Gateway.allOf()Route to ALL paths (AND)

Builder Support

Timer Event, Subflow, and Loop nodes are created via direct LeafWorkflowNode / ContainerWorkflowNode construction or JSON definitions. They don't have dedicated WorkflowBuilder convenience methods.

Basic Flow Example

dart
final workflow = WorkflowBuilder('BASIC', 'Basic Flow')
    .start('begin')
    .task('processData', ...)
    .userTask('review', ...)
    .oneOf('decide', [...])
    .end('success')
    .end('failure')
    .connect('begin', 'processData')
    .connect('processData', 'review')
    .connect('review', 'decide')
    .build();

Node Categories

Control Flow Nodes

  • Start - Single entry point
  • End - Terminal points (can have multiple)

Activity Nodes

  • Task - Automated tasks
  • User Task - Human interaction tasks

Wait Nodes

  • Signal Wait - Wait for external signals
  • Timer Event - Wait for a duration or a specific date/time

Container Nodes

  • ForEach Loop - Iterate over a collection with automatic state management
  • While Loop - Repeat child nodes while a condition is true

Subprocess Nodes

  • Subflow - Invoke another workflow as a child process

Gateway Nodes

  • Exclusive (oneOf) - Route to exactly ONE path
  • Race (anyOf) - Race paths, first to complete wins
  • Parallel (allOf) - Fork/join for concurrent execution

Node Structure

All nodes share common properties via LeafWorkflowNode:

dart
class LeafWorkflowNode {
  final String id;                      // Unique identifier
  final String name;                    // Human-readable name
  final NodeType type;                  // Node type enum
  final NodeConfiguration? config;      // Type-safe configuration
}

Node configurations are type-safe with specific classes for each node type:

dart
switch (node.config) {
  case ServiceTaskNodeConfiguration config:
    print('Task executor: ${config.schemaType}');
  case UserTaskNodeConfiguration config:
    print('User task title: ${config.title}');
  case TimerEventNodeConfiguration config:
    print('Timer type: ${config.timerType}');
  case SubflowNodeConfiguration config:
    print('Child workflow: ${config.workflowCode}');
  case ForEachLoopNodeConfiguration config:
    print('Collection: ${config.collectionPath}');
  case WhileLoopNodeConfiguration config:
    print('Condition: ${config.conditionPath}');
  case SplitJoinNodeConfiguration config:
    print('Split type: ${config.splitType}');
  // ... other configuration types
}

Most nodes use LeafWorkflowNode. Loop nodes use ContainerWorkflowNode, which adds a nodeIds property listing child nodes that execute within the loop body.

Next Steps