ProcessorBinding

One handler of an annotated subscription processor, bound to its processor instance: what the compiler generates for each @OnEvent function of a @Projection, @Reactor or @Saga, exposed by its module's ModelProvider.processors. It knows no runtime: the runtime compiles each into one subscription named name, processor.function.

  • stateType is the state of the StateEvent<S> the handler takes: the subscription reads the aggregates of its context whose state is one, and hands each commit over with the state after it. Null for StateEvent<*>: every aggregate of the context. nullableState says the handler takes a null state, StateEvent<S?> or StateEvent<*>: what a stream another context publishes without its state needs.

  • aggregates are those @OnEvent(aggregates) names, context.aggregate, all of one context. When they are of another context than the module's (sourceContext), the handler reads that context's published streams instead of the log: its state, if any, is decoded from the published state into stateType, and its events are the published ones.

  • startFrom is where the subscription starts in a partition it has no checkpoint in yet, as @OnEvent(start) declares it; null leaves it to startIn: a projection from the beginning, so it builds its read model from the whole history, and so does any handler of another context's stream, so a service that joins later still gets what that context published before; a reactor or a saga of its own context's log from its end (a new subscription chooses), so deploying one does not replay side effects or derive commands for the history.

  • blocking (@Blocking) asks the runtime to run the call on virtual threads instead of inline.

  • retry (@Retry on the handler or its processor) is the handler's own in-process retry budget, under what the host configures for its subscription and over the host's global one.

  • invoke calls the handler directly and returns the commands a saga derives; a projection's or a reactor's none.

  • rejections are a saga's @OnRejected handlers, the same for each handler of the saga: the runtime hands the rejection of a command this handler derived to the one rejectionHandlerOf its class.

  • commits are a saga's @OnCommitted handlers, likewise: the runtime hands the success receipt of a command this handler derived to the one committedHandlerOf its class, and only such a command asks for one.

  • job is the job of a saga's @OnSchedule handler (schedule): its subscription reads the job's instances of the context's built-in job aggregate (<context>.schedule, JobState) and hands each of their ticks over as a ScheduleTick.

Built with project, react or saga, one per kind, or schedule for a saga's job.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The bounded context whose job aggregate an @OnSchedule handler's job runs in, as the compiler that generated the binding knew it (wow.context, else the module's @BoundedContext); null when it knew none, and for an @OnEvent handler, which the runtime binds in its context.

Link copied to clipboard
val eventType: Class<*>?

The event type a handler of each event of a type takes: a stream without one is acknowledged without being handed over, nor its state decoded. Null for a handler of the whole stream.

Link copied to clipboard

The handler function's name.

Link copied to clipboard

The job of an @OnSchedule handler (schedule); null for an @OnEvent one.

Link copied to clipboard
Link copied to clipboard

The subscription the handler is compiled into: processor.function.

Link copied to clipboard
Link copied to clipboard

The processor's name: its @Name, or its class's simple name.

Link copied to clipboard
Link copied to clipboard

The handler's own in-process retry budget (@Retry); null when it gives none.

Link copied to clipboard

What a saga's handler declares it sends (@Sends, else its return type for what it derives): the only commands its context lets it derive, schedule and call. None for any other handler.

Link copied to clipboard

The context of the aggregates the handler names; null when it names none: its module's.

Link copied to clipboard

Where @OnEvent(start) says the subscription starts; null when it leaves that to startIn.

Link copied to clipboard
val stateType: Class<S & Any>?

Functions

Link copied to clipboard

The @OnCommitted handler of the saga for the success receipt of a command of command this handler derived (CommittedBinding.handlerOf); null when the saga has none for it, and the command asks for no receipt.

Link copied to clipboard
suspend fun invoke(event: StateEvent<*>, context: SubscriptionContext): List<Command<*>>

Calls the handler with event, whose state is a stateType, and the context of its kind (contextOf), in the caller's coroutine: running a blocking one elsewhere is the runtime's. A saga's requests become the commands its context's Derivation makes of them.

Link copied to clipboard
fun isSourced(context: String): Boolean

Whether the handler reads the published streams of a context other than context, its module's.

Link copied to clipboard

This handler reading aggregates, context.aggregate: those of another context whose events it takes by type without naming them, which the service's Manifest finds from the peer contracts.

Link copied to clipboard

The @OnRejected handler of the saga for the rejection of a command of command this handler derived (RejectionBinding.handlerOf); null when the saga has none for it.

Link copied to clipboard
fun skips(events: List<Any>): Boolean

Whether events, a stream's decoded events, hold none this handler takes: a handler of each event of an eventType skips a stream without one.

Link copied to clipboard
fun startIn(context: String): StartFrom

Where the subscription starts, in a partition it has no checkpoint in yet, when its module's context is context: startFrom when the handler declares it; otherwise from the beginning for a projection, where the service joins the stream for a reactor's or a saga's handler of another context's stream (isSourced, StartFrom.JOIN), from the end for a reactor or a saga of its own context's log.

Link copied to clipboard
open override fun toString(): String