Architecture & Triggers

Struktural Workflows execute outside the HTTP request lifecycle. They are processed by background workers (or scalable consumers if using Kafka) ensuring the UI remains highly responsive.

Ephemeral Execution (Snapshotting)

The engine uses a stateless, ephemeral execution model to optimize RAM.

  1. When a workflow starts, an execution context is created in memory containing the database context, the target entity, and user variables.
  2. The workflow executes nodes synchronously at extreme speed until it hits a "Wait State" (e.g., waiting for a date or a user approval).
  3. Upon hitting a wait state, the engine serializes the variables into JSON, saves a Struktural_Sys_WorkflowInstance snapshot to the database, and destroys the thread.
  4. When the wait condition is met, a worker reads the JSON, rehydrates the memory state, and resumes execution seamlessly.

Designing Workflows via the Studio UI

Administrators construct workflows using an interactive drag-and-drop designer.

  1. Navigate to the Workflows module and click Create Workflow.
  2. Node Palette (Left): Drag desired actions (e.g., SendEmail, UpdateRecord) and logic gates (DecisionSplit) onto the canvas.
  3. Canvas (Center): Connect the flow by dragging lines from a node's output handle (bottom) to another node's input handle (top).
  4. Configuration (Right): Click any node on the canvas to open its properties pane. Here you configure dynamic expressions, target variables, and specific settings for that node type.

Workflow Designer

Configuring Triggers

A workflow is initiated by configuring its Trigger object.

1. EntityEvent Trigger

Triggers reactively when a record is modified.

2. Schedule Trigger (Cron)

Triggers repeatedly on a defined schedule and processes a massive batch of records (Fan-Out).

3. Webhook Trigger

Allows external systems to start a workflow by making a POST request to /api/workflows/{workflowId}/webhook. The JSON payload sent by the external system is automatically deserialized and injected into the @Entity variable of the execution context.