OnEvent

@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class OnEvent(val aggregates: Array<String> = [], val start: OnEvent.Start = Start.DEFAULT)

An event handler of a Projection, Reactor or Saga: it takes a me.ahoo.wow.api.subscribe.StateEvent and, optionally, the processor's context: a projection's or a reactor's SubscriptionContext, a saga's SagaContext or the SubscriptionContext it extends. A saga's handler declares what it sends with Sends. Each handler is its own subscription, named processor.function, or processor.name with its Name. Only this annotation declares a handler, whatever the function's name.

Parameters

aggregates

the aggregates the handler reads, each context.aggregate, all of one context. Empty, the default, reads the aggregates of the module's context whose state is the handler's state type. An aggregate of another context is read from the state events that context publishes, and the handler's state type is then the subscriber's view of that state.

start

where the handler's subscription starts in a partition it has no checkpoint in yet, which the compiler writes into the Manifest; the host's wow.subscriptions.[<context>.<processor.function>].start overrides it. Start.DEFAULT starts a projection at the Start.BEGINNING; a reactor or a saga of its own context's stream at the Start.END, so deploying it does not act on the history again; a reactor's or a saga's handler of another context's stream where its service joins the stream: at the Start.BEGINNING when no other subscription of the service reads it yet, so a service that joins later still gets what was published before, else at the Start.END, so a handler added later does not act on it again. A subscription that has a checkpoint goes on from it, whatever this says.

Types

Link copied to clipboard
enum class Start : Enum<OnEvent.Start>

Where a subscription without a checkpoint starts.

Properties

Link copied to clipboard
Link copied to clipboard