LemonCore. Events. RunPhaseChanged
(lemon_core v0.1.0)
View Source
A run moved between lifecycle phases. Published on run:<run_id> by both the gateway
run process and the router's phase publisher.
Replaces LemonCore.RunPhaseEvent.build/1, which was this struct written as a map.
Summary
Functions
Build a phase change, validating both phases against LemonCore.RunPhase.
The LemonCore.Event type atom this payload is published under.
Payload version. Bumped only for a breaking field change (see the semver table in docs/platform/bus-events.md §4.3).
The struct's field names, in declaration order.
Build the payload from a map that may be a legacy free-form payload.
Build the payload, raising on unknown or missing keys.
Types
Functions
Build a phase change, validating both phases against LemonCore.RunPhase.
@spec event_type() :: atom()
The LemonCore.Event type atom this payload is published under.
@spec event_version() :: pos_integer()
Payload version. Bumped only for a breaking field change (see the semver table in docs/platform/bus-events.md §4.3).
@spec fields() :: [atom()]
The struct's field names, in declaration order.
Build the payload from a map that may be a legacy free-form payload.
Unknown keys are dropped and string keys are accepted, so a consumer can coerce whatever arrives on the topic. Enforced keys are still required — a map missing them is not a valid payload under any version.
Build the payload, raising on unknown or missing keys.
This is the publisher-side constructor: a typo should fail at the point of publish, not silently produce a payload with a nil field that a consumer reads as absent.