Event Examples
From the Concert App tutorial.
Follow graph
# events/follow.events.causet
events:
ARTIST_FOLLOWED:
state: user
entity_expr: event.user_id
payload:
user_id: string
artist_id: string
ARTIST_UNFOLLOWED:
state: user
entity_expr: event.user_id
payload:
user_id: string
artist_id: stringShows and attendance
events:
SHOW_ANNOUNCED:
state: artist
entity_expr: event.artist_id
payload:
artist_id: string
show_id: string
venue_id: string
title: string
date: string
USER_MARKED_GOING:
state: user
entity_expr: event.user_id
payload:
user_id: string
show_id: string
USER_CHECKED_IN:
state: user
entity_expr: event.user_id
payload:
user_id: string
show_id: string
artist_id: string
venue_id: string
CONCERT_MEMORY_CREATED:
state: user
entity_expr: event.user_id
payload:
user_id: string
show_id: string
artist_id: string
venue_id: string
checked_in: booleanDesign note: CHECK_IN emits both USER_CHECKED_IN (attendance counters) and CONCERT_MEMORY_CREATED (user memory projection) — different projections listen to different facts.
Reviews
events:
REVIEW_SUBMITTED:
state: user
entity_expr: event.user_id
payload:
user_id: string
show_id: string
artist_id: string
rating: int
notes: stringSystem event
events:
PROJECTION_FAILED:
state: _system
kind: system
entity_expr: event.entity_id
payload:
projection_name: string
error: stringMore examples
| Example | Events demonstrated |
|---|---|
| Concert App | Full event catalog with actions |
| Defining Events | Payload types and kind |
| Dispatching Events | op: emit from rules |
Next steps
- Event Naming — conventions
- Projection Examples — consumers of these events
- Intent Examples — emit patterns