AggregateModelBuilder
The Kotlin DSL of an aggregate model. Command and event types are named context.aggregate.Name after their class's @Name, else its simple name, unless a name is given: the name the compiler gives them, so a model written by hand stores what the Manifest says. A name given that disagrees with the class's @Name, or an aggregate named otherwise than its @AggregateRoot state class, fails here: the log would hold names the Manifest does not.
Properties
Functions
Declares the access attribute attribute, several values of the state that read gives, as access of one value does.
Declares the access attribute attribute, one value of the state that read gives, null for none: a fact the aggregate's access policies compare with a caller's claims (AggregateModel.accessOf). read is a pure, cheap function of the state, derived on each commit: it reads the state alone, does no I/O, reads no clock and draws no random number. A state member marked @Access calls it in a generated model, a value class unwrapped.
Reads the aggregate id of a command of commandType from its body; see the reified overload.
Adds the decide function of commandType. A decide function of a lifecycle command overrides the kernel's, to add domain rules to it: it decides the command's own lifecycle event (AggregateDeleted for DeleteAggregate) beside the aggregate's own events, NoOp or a rejection, and deciding another lifecycle event fails the command (LifecycleOverride). An override of RestoreAggregate is decided on a deleted aggregate as the kernel's is, so it takes no onDeleted. The schedule commands (wow.schedule.*) are the kernel's alone: a decide function schedules with DecideScope.schedule.
An after hook for every command that is one of include and none of exclude: its events follow the command's own in the same stream. An empty include is every command of the model's own decide functions, not the system commands the kernel decides (lifecycle and wow.schedule): a hook runs after one of those only when include names it. With produces, the events it may return, any other fails the command (AfterFunction.produces).
Decides commands of type C, named name, with a plain function: the fast path. An onDeleted command is decided on a deleted aggregate too (DecideFunction.onDeleted). With produces, the events it may decide, a decision holding another fails the command (DecideFunction.produces).
Decides commands of type C, named name, with a function that blocks its thread (@Blocking), such as one calling JDBC: the kernel runs it on its blocking dispatcher, a virtual thread, so it does not hold a worker thread.
Decides commands of commandType with a function that blocks its thread; see the reified overload.
The name of a command or event type declared without one: context.aggregate.SimpleName, or the system name of a lifecycle command or event (Lifecycle).
Evolves the state by changing it in place: the default, concise form.
Evolves the state in place, reading the commit the event belongs to (EventStream: its time, operator and version, as the log records them), which a rebuild reads again alike.
Evolves the state by returning a new one, for immutable states.
Evolves an immutable state by returning a new one, reading the commit the event belongs to.
Where the aggregate's id comes from: AggregateIdSource.ASSIGNED unless this is called. @AggregateRoot(idSource) calls it in a generated model.
The state of an aggregate that has no event yet.
Enables only the lifecycle commands commands; all are enabled unless this is called, and calling it with none disables them. A command disabled is not handled, as any command the model does not decide; the lifecycle events stay readable. A decide function declared for a lifecycle command enables it too.
Who the aggregate belongs to besides its tenant: Ownership.OWNER unless this is called. @AggregateRoot(ownership) calls it in a generated model.
Retires the events stored under names (9.x DroppedEvent): the aggregate no longer has them, and their records left in the log are skipped, never decoded. Each is a full stored name, context.aggregate.Event; none may name a current event or command type, or be one of their former names. @AggregateRoot(retiredEvents) calls it in a generated model.
The revision of the state's structure its snapshots are written at: 1 unless this is called. @AggregateRoot(stateRevision) calls it in a generated model.