fengling-console/.planning/phases/03-gateway-config-broadcast/03-PLAN.md

113 lines
3.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
phase: 03-gateway-config-broadcast
plan: 01
type: execute
wave: 1
depends_on: []
files_modified: []
autonomous: true
requirements: []
user_setup: []
must_haves:
truths:
- "现有广播机制已文档化"
- "路由 -> 服务 -> 下游流程已理解"
- "配置变更事件已验证可用"
artifacts:
- path: ".planning/phases/03-gateway-config-broadcast/03-SUMMARY.md"
provides: "阶段执行摘要"
key_links: []
---
<objective>
分析和文档化现有的网关配置广播机制。理解从路由配置到下游服务的完整链路,并验证配置变更事件广播是否正常工作。
</objective>
<context>
@.planning/phases/01-gateway-config-management/01-SUMMARY.md
@.planning/phases/01-gateway-config-management/01-PLAN.md
## 现有实现(来自 Phase 1
广播机制使用 PostgreSQL NOTIFY
- **通道:** `gateway_config_changed`
- **事件类型:** service, route, instance, gateway
- **操作:** create, update, delete, reload
- **服务:** ConfigNotificationService.cs
- **集成:** GatewayService.cs 在所有 CRUD 操作时触发广播
</context>
<tasks>
<task type="auto">
<name>任务 1: 分析现有广播实现</name>
<files>src/Services/ConfigNotificationService.cs, src/Services/GatewayService.cs</files>
<action>
分析现有实现以了解:
1. ConfigNotificationService 如何工作PostgreSQL NOTIFY
2. GatewayService 如何在 CRUD 操作时触发广播
3. 发送的事件类型和载荷是什么
阅读源代码并记录发现。
</action>
<verify>
<automated>文件存在且包含通知逻辑</automated>
</verify>
<done>实现分析完成,发现已记录</done>
</task>
<task type="auto">
<name>任务 2: 绘制路由 -> 服务 -> 下游流程</name>
<files></files>
<action>
文档化完整配置链路:
1. 路由如何在 Console 中定义
2. 路由如何映射到服务
3. 下游 Gateway 如何发现服务
4. 配置变更时,广播如何到达下游
参考 src/Models/、src/Services/、src/Controllers/ 中的现有代码
</action>
<verify>
<automated>流程文档已创建</automated>
</verify>
<done>配置链路已文档化</done>
</task>
<task type="auto">
<name>任务 3: 验证广播端到端工作</name>
<files></files>
<action>
验证广播机制:
1. 检查 PostgreSQL LISTEN/NOTIFY 是否正确配置
2. 验证 ReloadGatewayAsync 发送正确事件
3. 确认所有 CRUD 操作(服务/路由/实例)都触发广播
4. 如可能,测试端到端流程
</action>
<verify>
<automated>编译成功API 端点可用</automated>
</verify>
<done>广播验证完成</done>
</task>
</tasks>
<verification>
1. 阅读并分析 ConfigNotificationService.cs
2. 阅读并分析 GatewayService.cs
3. 文档化路由 -> 服务 -> 下游流程
4. 验证编译通过
</verification>
<success_criteria>
- [x] 现有广播实现已分析
- [x] 配置链路已文档化
- [x] 广播事件已验证
- [x] 摘要已创建
</success_criteria>
<output>
完成后创建 `.planning/phases/03-gateway-config-broadcast/03-SUMMARY.md`
</output>