StateEvent
What a subscription handler receives: one committed event stream of an aggregate, its events decoded (and upgraded to their current revision), with the aggregate's state after the commit. The events of another context's published stream are the classes of that context's api module, or a PublishedEvent for one the subscriber has no class of at its revision.
ref and version identify the commit: version is the aggregate's version after it. id (
ref@version) is the causation id of the commands a saga derives from it.commandId, requestId and commandType (the model's name of the command) say which command produced it; commitTime is when, in epoch milliseconds.
scope is the aggregate's owner and space after the commit, not the caller's; the commands a saga derives from it carry it on.
causation and headers come from the command: the chain it belongs to and the request facts admission kept.
operator is whose name the commit is recorded in; the commands a saga derives from it keep it.
state is a copy read from the commit's shared state, never the live instance: changing it affects no one. It is the state after the whole commit, also for a StateTypedEvent of one of its events. The runtime decodes it on its first read, so a handler that only reads events costs no decoding; a state that does not decode fails that read, and a handler that catches every exception there swallows the failure with it. A handler of another context's published stream declares a nullable state, StateEvent<OrderStateView?>, when the upstream publishes the stream without it: state is then null. S is covariant, so a StateEvent<OrderStateView> is a StateEvent<OrderStateView?>.
A handler that takes a StateEvent<S> is called once per stream; one that takes a StateTypedEvent of an event type, or the event itself, once per event of that type in the stream.
Members may be added: the runtime builds it, and a test builds one with the test DSL's stateEvent; building one is internal to Wow.
Inheritors
Properties
Functions
This stream with the given fields replaced, a whole stream again: Wow's own copy, left out of the ABI.