编辑 | blame | 历史 | 原始文档

事件墙模板(03-event-storming/-event-map.mmd)

一个限界上下文一张。左→右为时间线;先铺事件(橙),再补命令(蓝)→执行者→聚合(黄)→策略(紫)→外部系统→hotspot(红)。

flowchart LR
  %% ===== 事件(橙)—— past tense,业务在乎"发生过" =====
  EVIncidentCreated["E01 IncidentCreated"]:::event
  EVIncidentAssigned["IncidentAssigned"]:::event
  EVIncidentResolved["IncidentResolved"]:::event

  %% ===== 命令(蓝)—— 谁的动作触发了事件 =====
  CMCreateIncident["CreateIncident"]:::command
  CMAssignIncident["AssignIncident"]:::command

  %% ===== 聚合(黄)—— 事务边界,一个根 =====
  AGIncident["Incident"]:::aggregate
  AGAssignmentTask["AssignmentTask"]:::aggregate

  %% ===== 策略(紫)—— "每当 X 则 Y" =====
  POAutoDispatch["每当分派任务超时未接单,则升级班长"]:::policy

  %% ===== 执行者 / 外部系统 / hotspot =====
  ACReporter["报告人"]:::actor
  ACDispatcher["派单员"]:::actor
  EXMonitor["监控告警"]:::external
  HS1["超时标准是 SLA 还是固定值?"]:::hotspot

  ACReporter --> CMCreateIncident --> AGIncident --> EVIncidentCreated
  ACDispatcher --> CMAssignIncident --> AGIncident --> EVIncidentAssigned
  EVIncidentCreated --> AGAssignmentTask
  POAutoDispatch -.-> CMAssignIncident

  classDef event fill:#ff9800,color:#000
  classDef command fill:#2196f3,color:#fff
  classDef aggregate fill:#ffeb3b,color:#000
  classDef policy fill:#9c27b0,color:#fff
  classDef actor fill:#c8bfe8,color:#000
  classDef external fill:#f48fb1,color:#000
  classDef hotspot fill:#f44336,color:#fff

规则

  • 事件节点语法必须是 EV名["E编号 名"]:::event(如 EVIncidentCreated["E01 IncidentCreated"]:::event)——check.sh 靠 :::event + 引号内文本提取并剥离编号;编号三处同号(墙/登记表/时序档文件名)
  • 命令→聚合→事件 的箭头方向固定(命令由执行者发出,聚合产生事件)
  • 事件→聚合 的箭头表示"该聚合订阅/消费此事件"
  • 时间线顺序大致从左到右,不追求精确
  • 每个 hotspot 必须同步登记到设计根的 open-questions.md(check.sh 检查:墙上有 hotspot 而 open-questions.md 缺失即失败);阶段 4 转 spec 时逐条转 [NEEDS CLARIFICATION]
  • 拒绝事件也是橙色事件节点(<命令>Rejected,:::event)——不是 hotspot;check.sh 双向校验,墙外事件出现在状态图即失败