Skip to content

dynamic-consistency-boundary

Selector-based consistency unit whose scope is determined per Command. See Concepts: Dynamic Consistency Boundary.

Fields

Field Required Description
apiVersion yes schema.esdm.io/core/v1
kind yes dynamic-consistency-boundary
name yes The DCB name.
scope yes scope.boundedContext reference.
identifiedBy yes Non-empty list of identifier components.
consults yes Non-empty list of Event references the DCB consults.
invariants no Named rules over the consulted state.
description no Free-form prose.
metadata no Non-semantic labels and annotations.

identifiedBy[]

Each component carries a name and a discriminated source.

source Sibling field Description
command-payload field Value taken from the triggering Command's data.
static value Fixed identifier string.
generated generator Value produced by a named strategy (uuid, ulid, ...).

The state source available on aggregate.identifiedBy is intentionally absent here – DCBs have no container-level state.

consults[]

Each entry references an Event the DCB takes into account when forming its decision state, plus a prose criteria describing which occurrences are relevant.

Field Required Description
boundedContext yes The Bounded Context the Event lives in.
aggregate when the Event is Aggregate-bound The Aggregate that owns the Event. Omit for free-standing BC-scoped Events.
event yes The Event name.
criteria yes Prose description of which occurrences the DCB consults.

Example

apiVersion: schema.esdm.io/core/v1
kind: dynamic-consistency-boundary
name: course-enrollment-cap
scope:
  domain: school
  boundedContext: enrollment
identifiedBy:
  - name: courseId
    source: command-payload
    field: courseId
consults:
  - boundedContext: enrollment
    aggregate: enrollment
    event: enrollment-recorded
    criteria: All `enrollment-recorded` events with the same `courseId`.
invariants:
  - name: at-most-thirty-students
    rule: A course may have at most 30 enrolled students.