Cohesive Systems logoCOHESIVE SYSTEMS

Command

A command is an observer-relative interpretation of an input event as an attempted transition.

All inputs to an operation are modeled as input events subject to interpretation. They become commands only when an observer interprets them as attempted transitions for a target subject.

Command interpretation proceeds as follows:

Exogenous event
  -> input event at an observer boundary
  -> command intent, relative to the observer and target subject
  -> validation against current entity state, required observations, invariants, policies, authority, and expected version
  -> accepted transition | nil | rejection

Commands are not mere messages. They are interpretations made relative to:

A command's expected version is the version of entity state the observer believed was current when it formulated the command. The transition runtime checks that expectation before accepting the transition and advancing the entity version.

An exogenous event does not become a command by structure alone. It becomes a command only when interpreted as a requested transition for a subject in a specific context.

A query is the corresponding observer-relative interpretation of input as a request to observe, compute, or return information without requesting a modeled semantic state transition.

In CQRS, commands belong to the write side: they are interpreted against the authoritative model and may commit transitions that later become visible to queries through projections, read models, or other reconstitution paths.

Related concepts: value, shape, observation, query, CQRS, observer, boundaries, entity, transition, version, concurrency control, monads monoids and duals, adjunctions.