CreationIds

class CreationIds(ids: IdGenerators = IdGenerators.DEFAULT, committed: CommittedRequests = CommittedRequests.NONE)

The ids admission gives the creation commands that name none: a command, a client's or one a saga derived, whose request already committed takes the id of the aggregate it created, without drawing a new one, so a retry or a replay keeps it; any other takes a new one from its aggregate type's generator in ids. Committed ids never change. A concurrent duplicate may still draw a number that is then not used: ids are stable, not gap-free.

The committed request is reused only within the scope that sent it: a caller outside it gets a new id and is refused by the kernel as for any duplicate, so it learns nothing of the aggregate the request created.

Constructors

Link copied to clipboard
constructor(ids: IdGenerators = IdGenerators.DEFAULT, committed: CommittedRequests = CommittedRequests.NONE)

Functions

Link copied to clipboard
suspend fun <C : Any> assign(model: AggregateModel<*>, command: Command<C>): Command<C>

command, a command of model, with its aggregate id assigned when it names none (me.ahoo.wow.api.aggregate.AggregateRef.isAssigned); fails for a command that does not create its aggregate. An aggregate whose id is its owner's takes the command's owner, and fails for a command with none.

Link copied to clipboard
suspend fun idOf(type: AggregateType, tenantId: String, requestId: String, scope: Scope = Scope.NONE, ownership: Ownership = Ownership.OWNER): String

The id of the aggregate of type that a creation command of request requestId in tenantId, in scope, targets: that of the stream its request committed, else a new one. An aggregate of ownership checks only that part of the scope.