Structure Keywords
Keywords for defining machines, systems, and scenarios.
machine:
Defines a machine template (actor) in the system.
flow
machine: @orderThe machine name must be prefixed with @.
Template vs Instance
A machine: definition is a template. At runtime, instances (aggregates) are created from this template when events arrive:
- First event → creates new instance with unique ID (e.g.,
@order:abc123) - Subsequent events → route to existing instances via conversation context
See Instance Management for details on how instances are created and routed.
system:
Defines a multi-machine system.
flow
system: e-commerce checkoutscenario:
Defines a feature or capability of a machine.
flow
scenario: checkout flowA scenario groups related event handlers together.
uses:
Imports machines into a system from separate files.
flow
system: checkout
uses:
@order from "./order.flow"
@payment from "./payment.flow"