AfterFunction

sealed interface AfterFunction<S : Any>

An after hook: runs after the decide function of every command it applies to, sees the same, not yet evolved state, and returns events appended after the command's own, in the same event stream. It does not run when the command is rejected. A hook the model builder makes runs after a system command (a lifecycle or wow.schedule one) only when it names it (AggregateModelBuilder.after). Like a decide function it keeps its form; a Suspending.blocking one runs on a virtual thread.

Inheritors

Types

Link copied to clipboard
class Suspending<S : Any>(val applies: (Class<*>) -> Boolean, val blocking: Boolean, val after: suspend DecideScope.(S, Any) -> List<Any>, val produces: Set<Class<*>>? = null) : AfterFunction<S>

A suspending after hook; a blocking one blocks its thread, so the kernel runs it on a virtual thread.

Link copied to clipboard
class Sync<S : Any>(val applies: (Class<*>) -> Boolean, val after: DecideScope.(S, Any) -> List<Any>, val produces: Set<Class<*>>? = null) : AfterFunction<S>

Properties

Link copied to clipboard
abstract val applies: (Class<*>) -> Boolean
Link copied to clipboard
abstract val produces: Set<Class<*>>?

The events it may produce, as DecideFunction.produces; null when they are unknown, and then not checked.