executeHere

suspend fun executeHere(model: AggregateModel<*>, command: Command<*>, wait: WaitContext?): Settlement

Executes command on model's aggregate on this node, with the wait context it arrived with, and settles what it reaches at once: its result at COMMITTED, then its next HANDLED hop when that is already reached (a command that changed nothing appended no entry to handle; a duplicate whose subscription is past it). The node a command arrived at runs it so when its router chooses this node, and the owner of its partition runs it so for a forward.

A command the executor does not take is settled FAILED at COMMITTED, not thrown: its aggregate's lane is full or the node has its most commands in flight (ResultCodes.BUSY), or the executor is closed (ResultCodes.NODE_CLOSING). So is one that waited in its lane past its wait's deadline and was withdrawn before it ran (ResultCodes.WAIT_TIMEOUT: its waiter has gone, and it committed nothing). So is one whose execution a store failed with a transient failure (StorageUnavailableException, such as the request id's lookup during a restart): ResultCodes.STORAGE_UNAVAILABLE, which a retry with the same request id may pass, as the kernel deduplicates it. So is a scheduled command due longer from now than the kernel waits for one (ScheduleNotDueException): ResultCodes.SCHEDULE_NOT_DUE, logged with the clock skew; a timer of this context sends it again later, and the intake of a command another context's timer sent waits for its due time before it runs it, then retries it as any technical failure. An append whose outcome is unknown is ResultCodes.UNKNOWN, from the kernel. An event the model does not declare for the command (UndeclaredEventException) is ResultCodes.UNDECLARED_EVENT, with the message that names the model, the command and the event. Any other failure of its handling (a decide function or an after hook that throws, a missing dependency), which the kernel compensated, is ResultCodes.FAILED, logged with its cause and answered without it: the owner of a forwarded command answers it so, not with an error the sender could not tell from a lost reply.