Package-level declarations

Types

Link copied to clipboard
interface CommandClient

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). 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 id: String? = null, val type: AggregateType? = null, val targetTenant: String? = null, val targetScope: Scope? = 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.

Functions

Link copied to clipboard
suspend fun CommandClient.send(command: Any, id: String? = null): CommandResult

Sends command to the aggregate id names, its type derived from its class (CommandClient.send).

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 CommandClient.stream(command: Any, id: String? = null): Flow<CommandResult>

The results of command sent to the aggregate id names (CommandClient.stream).

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 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 CommandClient.wait(command: Any, id: String? = null): CommandResult

Sends command to the aggregate id names, and waits for its result (CommandClient.wait).