listeners — Deterministic In-Process Reactions
Listeners run synchronously within the same write transaction as the emitting action. They are deterministic and side-effect free (no I/O, no submit).
listeners:
- on: RATING_SUBMITTED
priority: 0
where: event.payload.score > 0 # optional filter (plain expression string)
resolve:
show: lookup(rating_summary, event.payload.show_id)
mutate:
- op: increment
field: score_sum
value: event.payload.score
- op: increment
field: score_count
value: 1
- op: set
field: updated_at
value: event.payload.ts
on: show # target the resolved entityListener fields
| Field | Required | Description |
|---|---|---|
on | yes | Event type to react to |
priority | no | Execution order (lower = earlier; default 0) |
where | no | Filter expression (plain string) |
resolve | no | Named entity lookups via lookup(entity, id_expr) |
mutate | yes | List of mutation ops |
Listener mutate ops
| Op | Description |
|---|---|
increment | Add a value to a numeric field |
set | Set a field to a value |
update | Update a field using an expression |
append | Append to an array |
remove | Remove from an array |
mutate.field uses slash-separated paths: stats/home_score.
mutate.on targets a resolved alias. Without on, the mutation targets the entity the event belongs to.