Skip to content

WorkflowRuntime

WorkflowRuntime is the durable orchestrator. It is not WorkflowEngine. Construct it with storage and modules.

dart
WorkflowRuntime({
  required WorkflowStorage storage,
  WorkflowRegistry? workflows,
  ActivityRegistry? activities,
  Iterable<WorkflowModule> modules = const [],
  WorkflowObserver observer = const NoopWorkflowObserver(),
  WorkflowRuntimeOptions options = const WorkflowRuntimeOptions(),
});

Direct Runtime API

APIPurpose
start(ref, input)Typed start
startEncoded(key, input)Wire/JSON start
drive(runId)Replay until blocked or terminal
requireState(runId)Load run, history, and commands
query(runId, name)Read-only published query
loadUserTaskLoad one projected task
claimUserTask / releaseUserTaskPooled assignment
completeUserTaskRecord response and resume
signalIdempotent external message
cancelCancel a run and runnable commands
retryActivityRetry exhausted work
redriveRe-evaluate a failed or stuck run
fireDueTimersFire due timers
expireDueUserTasksExpire bounded tasks
recoverRunnableRunsResume interrupted decisions
runOneServiceTaskLease and execute one activity
runOneWorkflowSpawnReconcile one spawn command

Starts accept an optional run ID, correlation ID, and WorkflowRunMetadata.

Options

dart
const WorkflowRuntimeOptions({
  int maxHistoryEvents = 50000,
  int continueAsNewSuggestedAt = 10000,
});

Production Host

Most products use WorkflowServerApplication from vyuh_workflow_service instead of calling these methods directly.

See Also