Skip to content
NEWMarketplace and your team: sell what you build, and get plans and changes that are tested before you see them. See what is new

Library / Building Blocks & Utilities

Building Blocks & Utilities

Run a generic state machine runtime with Data Tables and sub-workflows

When another workflow calls it, it provides a reusable building block using Data Table.

What it does

# Generic state-machine runtime ## How it works 1. The runtime rebuilds a case from accepted events and validates the next transition. 2. It appends one fact, starts the entered state’s task asynchronously, and returns the saved state. ## Setup - [ ] Connect machine_definitions, case_event_stream, and task_bindings Data Tables. - [ ] Bind tasks by machine + version + task and publish their workflows. ## Try it Call from an adapter with caseId, eventId, type and payload. A new case also needs machine + machineVersion. Read without writing: { "caseId": "your-case", "operation": "inspect" }. ## Expected result Applied, duplicate, rejected, or inspected; with state, sequence and outcome. Replay never starts tasks. PoC: sequential requests; append and dispatch are separate, with no automatic retry.

The steps

  1. Receive Event
  2. Prepare Event
  3. Read Machine Definitions
  4. Load Machine Definitions
  5. Find Event
  6. Plan Transition
  7. Append Event?
  8. Append Event
  9. Has Task?
  10. After Append
  11. Find Task Binding
  12. Prepare Task Dispatch
  13. Binding Available?
  14. Task Input

19 steps in total.

Similar automations