Load-time registry of workflow definitions.
The registry is mutable process state, so it lives in the shell — the core
(boundary.workflow.core.machine) stays pure (state-machine introspection
only). Definitions are registered at namespace load via the defworkflow
macro and read at runtime by the workflow service/wiring.
No business logic here — just the definition registry, the defworkflow
convenience macro, and the IWorkflowRegistry adapter.
Load-time registry of workflow definitions. The registry is mutable process state, so it lives in the shell — the core (boundary.workflow.core.machine) stays pure (state-machine introspection only). Definitions are registered at namespace load via the `defworkflow` macro and read at runtime by the workflow service/wiring. No business logic here — just the definition registry, the `defworkflow` convenience macro, and the IWorkflowRegistry adapter.
(clear-registry!)Remove all workflow definitions from the in-process registry. Use only in tests.
Remove all workflow definitions from the in-process registry. Use only in tests.
(create-workflow-registry)Create a WorkflowRegistry backed by the module-level atom.
Returns: WorkflowRegistry implementing IWorkflowRegistry
Create a WorkflowRegistry backed by the module-level atom. Returns: WorkflowRegistry implementing IWorkflowRegistry
(defworkflow sym definition-map)Define and register a workflow.
The body is a map literal that must satisfy WorkflowDefinition schema.
After macro expansion the definition is automatically registered in the
in-process registry so it is available via get-workflow.
Example:
(defworkflow order-workflow {:id :order-workflow :initial-state :pending :description "E-commerce order lifecycle" :states #{:pending :paid :shipped :delivered :cancelled} :transitions [{:from :pending :to :paid :required-permissions [:finance :admin]} {:from :paid :to :shipped} {:from :shipped :to :delivered} {:from :pending :to :cancelled} {:from :paid :to :cancelled}]})
The var order-workflow is bound to the definition map.
The workflow is registered under :order-workflow.
Define and register a workflow.
The body is a map literal that must satisfy WorkflowDefinition schema.
After macro expansion the definition is automatically registered in the
in-process registry so it is available via `get-workflow`.
Example:
(defworkflow order-workflow
{:id :order-workflow
:initial-state :pending
:description "E-commerce order lifecycle"
:states #{:pending :paid :shipped :delivered :cancelled}
:transitions [{:from :pending :to :paid
:required-permissions [:finance :admin]}
{:from :paid :to :shipped}
{:from :shipped :to :delivered}
{:from :pending :to :cancelled}
{:from :paid :to :cancelled}]})
The var `order-workflow` is bound to the definition map.
The workflow is registered under :order-workflow.(get-workflow workflow-id)Retrieve a registered workflow definition by id.
Args: workflow-id - keyword
Returns: WorkflowDefinition map or nil
Retrieve a registered workflow definition by id. Args: workflow-id - keyword Returns: WorkflowDefinition map or nil
(list-workflows)List the ids of all registered workflows.
Returns: Vector of keyword ids
List the ids of all registered workflows. Returns: Vector of keyword ids
(register-workflow! definition)Register a workflow definition in the in-process registry.
Args: definition - WorkflowDefinition map
Returns: :workflow-id keyword
Throws: ex-info with :type :validation-error when definition is invalid
Register a workflow definition in the in-process registry. Args: definition - WorkflowDefinition map Returns: :workflow-id keyword Throws: ex-info with :type :validation-error when definition is invalid
(unregister-workflow! workflow-id)Remove a workflow definition from the in-process registry. Primarily useful for tests.
Args: workflow-id - keyword
Returns: true if removed, false if not found
Remove a workflow definition from the in-process registry. Primarily useful for tests. Args: workflow-id - keyword Returns: true if removed, false if not found
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |