<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="675" viewBox="0 0 1200 675" role="img" aria-label="微服务分布式事务边界与一致性目标">
  <defs>
    <linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
      <stop offset="0" stop-color="#f7fbff"/>
      <stop offset="1" stop-color="#eef6f3"/>
    </linearGradient>
    <filter id="shadow" x="-20%" y="-20%" width="140%" height="140%">
      <feDropShadow dx="0" dy="8" stdDeviation="10" flood-color="#1f3a4d" flood-opacity="0.12"/>
    </filter>
    <marker id="arrow" viewBox="0 0 10 10" refX="8" refY="5" markerWidth="8" markerHeight="8" orient="auto-start-reverse">
      <path d="M 0 0 L 10 5 L 0 10 z" fill="#2f6f87"/>
    </marker>
  </defs>
  <rect width="1200" height="675" rx="0" fill="url(#bg)"/>
  <text x="60" y="58" font-family="Arial, sans-serif" font-size="26" font-weight="700" fill="#18384a">跨服务事务边界从本地数据库扩展到调用链</text>
  <text x="60" y="92" font-family="Arial, sans-serif" font-size="16" fill="#5d7180">每个服务先完成本地事务，再通过消息、补偿和对账维持整体一致性</text>

  <rect x="58" y="128" width="260" height="380" rx="22" fill="#ffffff" stroke="#d6e4ec" filter="url(#shadow)"/>
  <text x="88" y="168" font-family="Arial, sans-serif" font-size="20" font-weight="700" fill="#214a5b">订单服务</text>
  <rect x="88" y="198" width="200" height="72" rx="14" fill="#e9f3ff" stroke="#b9d8f4"/>
  <text x="112" y="226" font-family="Arial, sans-serif" font-size="15" fill="#27516a">本地事务</text>
  <text x="112" y="250" font-family="Arial, sans-serif" font-size="14" fill="#557082">创建订单 / 写状态</text>
  <rect x="88" y="298" width="200" height="72" rx="14" fill="#f4f9ec" stroke="#cfe3ab"/>
  <text x="112" y="326" font-family="Arial, sans-serif" font-size="15" fill="#3f6231">事务事件</text>
  <text x="112" y="350" font-family="Arial, sans-serif" font-size="14" fill="#617a56">订单已创建</text>
  <rect x="88" y="398" width="200" height="70" rx="14" fill="#fff5e8" stroke="#ecc88d"/>
  <text x="112" y="426" font-family="Arial, sans-serif" font-size="15" fill="#7d5521">状态机</text>
  <text x="112" y="450" font-family="Arial, sans-serif" font-size="14" fill="#7c684f">待支付 / 已取消</text>

  <rect x="470" y="128" width="260" height="380" rx="22" fill="#ffffff" stroke="#d6e4ec" filter="url(#shadow)"/>
  <text x="500" y="168" font-family="Arial, sans-serif" font-size="20" font-weight="700" fill="#214a5b">库存服务</text>
  <rect x="500" y="198" width="200" height="72" rx="14" fill="#e9f3ff" stroke="#b9d8f4"/>
  <text x="524" y="226" font-family="Arial, sans-serif" font-size="15" fill="#27516a">本地事务</text>
  <text x="524" y="250" font-family="Arial, sans-serif" font-size="14" fill="#557082">预占库存 / 释放库存</text>
  <rect x="500" y="298" width="200" height="72" rx="14" fill="#f4f9ec" stroke="#cfe3ab"/>
  <text x="524" y="326" font-family="Arial, sans-serif" font-size="15" fill="#3f6231">补偿动作</text>
  <text x="524" y="350" font-family="Arial, sans-serif" font-size="14" fill="#617a56">支付失败后回滚占用</text>
  <rect x="500" y="398" width="200" height="70" rx="14" fill="#fff5e8" stroke="#ecc88d"/>
  <text x="524" y="426" font-family="Arial, sans-serif" font-size="15" fill="#7d5521">幂等键</text>
  <text x="524" y="450" font-family="Arial, sans-serif" font-size="14" fill="#7c684f">订单号 + 商品行</text>

  <rect x="882" y="128" width="260" height="380" rx="22" fill="#ffffff" stroke="#d6e4ec" filter="url(#shadow)"/>
  <text x="912" y="168" font-family="Arial, sans-serif" font-size="20" font-weight="700" fill="#214a5b">支付服务</text>
  <rect x="912" y="198" width="200" height="72" rx="14" fill="#e9f3ff" stroke="#b9d8f4"/>
  <text x="936" y="226" font-family="Arial, sans-serif" font-size="15" fill="#27516a">本地事务</text>
  <text x="936" y="250" font-family="Arial, sans-serif" font-size="14" fill="#557082">记录支付请求</text>
  <rect x="912" y="298" width="200" height="72" rx="14" fill="#f4f9ec" stroke="#cfe3ab"/>
  <text x="936" y="326" font-family="Arial, sans-serif" font-size="15" fill="#3f6231">外部回执</text>
  <text x="936" y="350" font-family="Arial, sans-serif" font-size="14" fill="#617a56">成功 / 失败 / 未知</text>
  <rect x="912" y="398" width="200" height="70" rx="14" fill="#fff5e8" stroke="#ecc88d"/>
  <text x="936" y="426" font-family="Arial, sans-serif" font-size="15" fill="#7d5521">对账任务</text>
  <text x="936" y="450" font-family="Arial, sans-serif" font-size="14" fill="#7c684f">修复不一致状态</text>

  <path d="M318 230 C370 230 418 230 470 230" stroke="#2f6f87" stroke-width="3" fill="none" marker-end="url(#arrow)"/>
  <text x="350" y="210" font-family="Arial, sans-serif" font-size="14" fill="#2f6f87">事件驱动</text>
  <path d="M730 230 C782 230 830 230 882 230" stroke="#2f6f87" stroke-width="3" fill="none" marker-end="url(#arrow)"/>
  <text x="762" y="210" font-family="Arial, sans-serif" font-size="14" fill="#2f6f87">异步确认</text>
  <path d="M882 352 C810 540 392 540 318 352" stroke="#c26b4a" stroke-width="3" stroke-dasharray="8 8" fill="none" marker-end="url(#arrow)"/>
  <text x="520" y="565" font-family="Arial, sans-serif" font-size="15" fill="#9b583e">补偿、重试与对账形成恢复闭环</text>

  <rect x="108" y="548" width="984" height="70" rx="18" fill="#18384a" opacity="0.95"/>
  <text x="148" y="579" font-family="Arial, sans-serif" font-size="16" font-weight="700" fill="#ffffff">一致性目标</text>
  <text x="148" y="604" font-family="Arial, sans-serif" font-size="14" fill="#d8e8ee">强一致用于关键约束，最终一致用于可补偿流程；状态机、幂等和对账决定系统能否恢复。</text>
</svg>
