Package-level declarations

Types

Link copied to clipboard
sealed interface CommandReceipt<C : Any>

The receipt of a command of type C a saga derived: Rejected (an @OnRejected handler takes it) or Committed (an @OnCommitted handler takes it). The command commandId of the full type name commandType was sent to ref. Its causation links it to the commit the saga handled and to the root of the chain, and executionId is the saga's execution that derived it, so what a handler derives in turn is deterministic too. operator is the command's, the root command's, which the handler's commands keep; so is scope, its owner and space, and so are headers, the request facts the command inherited from the commit the saga handled (me.ahoo.wow.api.decide.RequestFacts.PROPAGATED), such as the calling application. version is the version of ref the receipt answers; a rejection may have none.

Link copied to clipboard
data class ExecutionId(val subscription: String, val ref: AggregateRef, val version: Int)

One execution of a subscription's handler for one commit: the subscription (processor.function), the aggregate ref and the committed version. It is deterministic: handling the same commit again, after a retry, a replay or a lease handover, gives the same id. It is per stream: the idempotency key of an outside call is SubscriptionContext.invocationKey, which tells apart the calls of a handler for each event.

Link copied to clipboard
class PublishedEvent @InternalWowApi constructor(val name: String, val revision: Int, val payload: String)

An event of another context's published stream that the subscriber has no class for: its type name (context.aggregate.Event), the revision of its schema and its payload as JSON text.

Link copied to clipboard

The context of every handler of a me.ahoo.wow.api.annotation.Saga: its @OnEvent handlers, its @OnRejected and @OnCommitted handlers of the receipts of the commands it derives (CommandReceipt), and its @OnSchedule jobs' handlers. A handler returns the commands it derives as CommandRequests, one, several (an Iterable, a Sequence, a Flow) or none, and the subscription sends each, deterministic, so handling the same commit, receipt or tick again derives the same requests, which their targets decide once:

Link copied to clipboard
interface StateEvent<out S>

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.

Link copied to clipboard
interface StateTypedEvent<out S, out E : Any> : StateEvent<S>

One event of a committed stream, typed: the stream it belongs to, as a StateEvent, with its eventIndex-th event as event, an E. A handler that takes a StateTypedEvent<S, E> is called once for each event of the stream that is an E, in their order, all with the stream's state after the whole commit; a handler that takes an E itself is its shorthand. It is a view of the stream, not a copy: two are equal when their streams are and they are of the same event.

Link copied to clipboard

What every subscription handler can ask of the runtime besides the StateEvent it handles: the context of a me.ahoo.wow.api.annotation.Projection's or a me.ahoo.wow.api.annotation.Reactor's handler, and what every other context adds to.

Link copied to clipboard
open class UnrecoverableHandlingException(message: String, cause: Throwable? = null) : RuntimeException

A handler's failure that no retry changes, which the handler says itself: it throws this (or a subclass of it), and the subscription parks the aggregate at once, without a retry, marked for an operator to look at; a wait at the handler's hop ends FAILED. A reactor that finds the buyer unknown to its notification service, say: asking again will not change that. Thrown as the cause of another failure, it parks too.