Package-level declarations

Types

Link copied to clipboard

Sends command objects to aggregates, wherever they are served: the same calls reach an aggregate of this service in process, without encoding the command, and one of a peer context, known from the contract its api jar carries, through that context's command topic, or over HTTP with the HTTP implementation.

Link copied to clipboard

The command was rejected (CommandResult.Status.REJECTED): by its aggregate, a business outcome with the domain's code, or at admission (an unknown command, a malformed or invalid one, a forbidden caller), with the fields it broke (violations). Sending it again with the same request id is rejected again.

Link copied to clipboard
class CommandRequest<C : Any> @InternalWowApi constructor(val command: C, val aggregateId: String? = null, val type: AggregateType? = null, val targetScope: TargetScope? = null, val wait: WaitPlan? = null, val timeout: Duration? = null, val requestId: String? = null, val expectedVersion: Int? = null)

One command a CommandClient sends, and how: the command object, the aggregate it goes to, the scope it acts in and what the sender waits for.

Link copied to clipboard
annotation class CommandRequestDsl

Marks the receiver of a block that sets a CommandRequest's fields (CommandRequest.Builder), so that a block of it nested in another sees the inner receiver's names only.

Functions

Link copied to clipboard
suspend fun <C : Any> CommandClient.send(command: C, aggregateId: String? = null, block: CommandRequest.Builder<C>.() -> Unit = {}): CommandResult

Sends command to the aggregate aggregateId names (none for a creation), with the fields block sets, its type derived from its class unless the block sets it: CommandClient.send of command's toCommandRequest.

suspend fun <C : Any> CommandClient.send(command: C, to: AggregateRef, block: CommandRequest.Builder<C>.() -> Unit = {}): CommandResult

Sends command to the aggregate the ref to names, with the fields block sets; see send of an id.

Link copied to clipboard

request, which CommandClient.send sends: it answers on acceptance, so a request that waits for more, a wait plan other than ACCEPTED, fails before anything is sent rather than be answered sooner than it asks. Wow's clients' rule.

Link copied to clipboard
fun <C : Any> CommandClient.stream(command: C, aggregateId: String? = null, block: CommandRequest.Builder<C>.() -> Unit = {}): Flow<CommandResult>

The results of command sent to the aggregate aggregateId names, with the fields block sets: CommandClient.stream of command's toCommandRequest.

fun <C : Any> CommandClient.stream(command: C, to: AggregateRef, block: CommandRequest.Builder<C>.() -> Unit = {}): Flow<CommandResult>

The results of command sent to the aggregate the ref to names; see stream of an id.

Link copied to clipboard
fun targetTenantOf(request: CommandRequest<*>, callerTenant: String): String?

The tenant request targets, as callerTenant sends it: its target tenant, unless it is the caller's own, which changes nothing. Wow's clients' rule.

Link copied to clipboard
fun <C : Any> C.toCommandRequest(aggregateId: String? = null, block: CommandRequest.Builder<C>.() -> Unit = {}): CommandRequest<C>

A request of this command to the aggregate aggregateId names (none for a creation, whose id the server assigns, or a command its body or a transformer addresses), with the fields block sets, by the names of CommandRequest.Builder; toCommandRequest of a ref names the aggregate by its ref instead:

A request of this command to the aggregate the ref to names, as CommandRequest.to sends (its type, its id when assigned, its tenant), with the fields block sets; see toCommandRequest of an id.

Link copied to clipboard
fun typeOf(request: CommandRequest<*>, candidates: (Class<*>) -> List<AggregateType>): AggregateType

The aggregate type of request: its own, else the one candidates (the types that decide its command's class, as the client knows them) holds. A lifecycle command, which every type takes, none or several fail, saying to set the request's type. Wow's clients' rule.

Link copied to clipboard
suspend fun <C : Any> CommandClient.wait(command: C, aggregateId: String? = null, block: CommandRequest.Builder<C>.() -> Unit = {}): CommandResult

Sends command to the aggregate aggregateId names, with the fields block sets (wait(plan) among them), and waits for its result: CommandClient.wait of command's toCommandRequest.

suspend fun <C : Any> CommandClient.wait(command: C, to: AggregateRef, block: CommandRequest.Builder<C>.() -> Unit = {}): CommandResult

Sends command to the aggregate the ref to names and waits for its result; see wait of an id.