DecidingCommand

The command a decide function is deciding, by its aggregate ref and its requestId, in its coroutine context while it decides: one for each execution of the command, every attempt of it included (nextAttempt).

A command a Wow client sends from there takes nextRequestId as its request id unless its request gives one, as a saga's derived commands take theirs: a call that stands. The request id, not the command id, keys it: the gateway gives every arrival a new command id, while a caller's retry keeps the request id. So a decision decided again, after a version conflict or for a caller's retry of an attempt that called a peer and did not commit, sends the same requests again, which their targets answer as repeats rather than run twice: the n-th command an attempt sends is the n-th request of every attempt, as long as the decision sends them in order.

The aggregate's id is not part of it, its type and tenant are: a request id names one request of its aggregate type in its tenant, whichever aggregate it names (the log's request key), and admission gives a creation that names no aggregate a new id each time it handles it. So a caller's retry of such a creation, a copy its command topic delivers again and a saga's derived creation handled again send the same requests too.

A repeat is answered with the first call's commit, so a call decided again must be that same call. Within an execution, a call whose target, command type or body differs from the call that first took its index fails the command (Misuse.State): it would be answered with another call's commit. A call the decision undoes in onAppendFailure takes an id of its attempt's own instead (DecideScope.attemptKey()), and a call that may change takes a business request id.

Constructors

Link copied to clipboard
constructor(ref: AggregateRef, requestId: String)

Types

Link copied to clipboard

Properties

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Starts another attempt of the command: its calls take their indices from 0 again.

Link copied to clipboard

The request id of call, the next command sent while deciding without a request id of its own: requestIdOf the command and the call's index. A Misuse.State when an earlier attempt of this execution sent another call at that index.

Link copied to clipboard

This command, kept on whichever thread runs the coroutine it is added to, for a decide function that blocks its thread (@Blocking): its body calls a suspending client inside runBlocking { }, a coroutine whose context does not carry this element, on that same thread (requestIdOf, #7083). Restored as it was when the coroutine leaves the thread, so nothing else the thread runs finds it.

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