Skip to content

Commit c3fa6e4

Browse files
committed
feat:《AI MCP Gateway 网关服务系统》第3-11节:会话内容编排处理
1 parent 4ddd67b commit c3fa6e4

File tree

5 files changed

+34
-0
lines changed

5 files changed

+34
-0
lines changed

docs/.vuepress/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2324,6 +2324,7 @@ function getBarAIMCPGateway() {
23242324
"第3-8节:协议消息处理-ToolsList.md",
23252325
"第3-9节:协议消息处理-ToolsCall.md",
23262326
"第3-10节:评审库表升级代码.md",
2327+
"第3-11节:会话内容编排处理.md",
23272328
"none.md",
23282329
]
23292330
},
81.6 KB
Loading
286 KB
Loading
239 KB
Loading
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
title: 【更】第3-11节:会话内容编排处理
3+
pay: https://t.zsxq.com/7Oceg
4+
---
5+
6+
# 《AI MCP Gateway 网关服务系统》第3-11节:会话内容编排处理
7+
8+
作者:小傅哥
9+
<br/>博客:[https://bugstack.cn](https://bugstack.cn)
10+
<br/>视频:[https://t.zsxq.com/pxAAd](https://t.zsxq.com/pxAAd)
11+
12+
>沉淀、分享、成长,让自己和他人都能有所收获!😄
13+
14+
## 一、本章诉求
15+
16+
将目前在 MCP 网关服务接口管理(McpGatewayController)中的 handleMessage 下的逻辑代码,抽取到 case 进行编排处理,减轻 Controller 层的代码压力。
17+
18+
<div align="center">
19+
<img src="https://bugstack.cn/images/article/project/ai-mcp-gateway/ai-mcp-gateway-3-11-01.png" width="450px"/>
20+
</div>
21+
22+
这里有一个设计思想,Controller 接口实现的控制器层,在处理复杂逻辑的时候,都会调用很多 Service 服务。无论这个服务是贫血模型的 mvc 架构,还是充血模型的 ddd 架构。那么为了减轻 Controller 的职责,不至于让一个 Controller 的代码逻辑过于繁重,因此引入了 case 编排层。上承接 Controller 层的出入参需求,下处理 domian 领域服务的编排处理。这一层甚至不需要额外的对象包,它可以承接 Controller 的 DTO 对象作为出入参,也可以使用领域层的对象。
23+
24+
## 二、流程设计
25+
26+
如图,会话消息处理流程设计;
27+
28+
<div align="center">
29+
<img src="https://bugstack.cn/images/article/project/ai-mcp-gateway/ai-mcp-gateway-3-11-02.png" width="950px"/>
30+
</div>
31+
32+
- 首先,这部分的重点在于将原本的会话服务接口下的消息处理,直接调用 domain 领域层的部分,重构迁移到 case 层通过规则树的方式分摊 trigger 触发器下的 Controller 的压力。
33+
- 之后,这部分的 case 编排和会话 Session 处理的架构设计方案是一致的,使用的是星球「码农会锁」扳手工程下的通用设计模式组件。这部分的设计,只要具备编码式的规则树结构,可以划分职责的方式完成节点的拆分,就都可以作为编排设计工具使用。

0 commit comments

Comments
 (0)