events — Domain Events
Defines the events that the runtime can emit and persist to the ledger.
events:
ARTIST_FOLLOWED:
state: user # entity type this event belongs to
entity_expr: event.user_id # expression to extract entity ID from payload
kind: event # event | system | fact | compute | command (default: event)
description: "User follows an artist"
payload:
user_id: string
artist_id: string
followed_at: integer # epoch ms; never name this "ts"Event fields
| Field | Required | Description |
|---|---|---|
state | yes | Entity type this event targets |
entity_expr | yes | SpEL expression to extract entity ID from payload |
payload | yes | Payload schema: field name → type string |
kind | no | event (default), system, fact, compute, command |
description | no | Human-readable description |
Payload types
string, number, integer, boolean, array, object
Use ? suffix for nullable fields: note: string?
🚫
Reserved payload field names: type, ts, entity_id
These are always resolved from the event envelope, never from your payload. If you declare a payload field named type, ts, or entity_id, it will be silently shadowed in every expression context.
Use alternatives: notification_type, created_at, record_id.