Skip to content

Registration ​

The runtime registers handlers and contracts through WorkflowModule.

WorkflowModule ​

A product exports one module. The server installs it at construction. There is no per-definition registration call after start().

dart
final orders = WorkflowModule(
  name: 'orders',
  workflows: [orderApprovalHandler, fulfillmentHandler],
  operations: [
    reserve.implement(
      (operation, order) => reservationService.reserve(
        order,
        idempotencyKey: operation.context.idempotencyKey,
      ),
    ),
  ],
  work: [approve],
  events: [paymentReceived],
);

WorkflowRuntime and WorkflowServerApplication take the same modules list. Registration becomes immutable after the server starts.

What a Module Installs ​

ListMeaning
workflowsDart-authored or compiled JSON workflow handlers
operationsOperation handlers created from versioned contracts
workAssigned-work contracts and codecs
eventsExternal-event contracts and codecs

Do not wrap a single definition in its own helper module. Put related definitions in one product module.

Catalog Validation ​

Active workflow_versions rows must match code already linked into the worker. PostgreSQL cannot manufacture Dart functions. A digest mismatch fails startup instead of replaying history against the wrong binary.

See Also ​