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
| List | Meaning |
|---|---|
workflows | Dart-authored or compiled JSON workflow handlers |
operations | Operation handlers created from versioned contracts |
work | Assigned-work contracts and codecs |
events | External-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.