-
Notifications
You must be signed in to change notification settings - Fork 329
[FIT] 修改组件启动优先级并添加文档 #393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
CodeCasterX
merged 6 commits into
ModelEngine-Group:3.6.x
from
relat-ivity:example-fix-06
Dec 31, 2025
Merged
[FIT] 修改组件启动优先级并添加文档 #393
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| # FEL插件启动顺序说明 | ||
|
|
||
| ## 概述 | ||
|
|
||
| 本文档记录了 FEL 插件的启动顺序。当应用以 JAR 包方式运行时,FIT 框架会按照 **Level**值从小到大的顺序加载这些插件。 | ||
|
|
||
| **build/plugins 插件统计**: | ||
|
|
||
| - **FEL 插件**: 9个(本文档详细说明) | ||
| - **FIT 内置插件**: 20个(详见 `framework/fit/java/fit-builtin/plugins/FIT插件启动顺序说明.md`) | ||
|
|
||
| **启动规则**: | ||
|
|
||
| - **数值越小,启动优先级越高** | ||
| - **同一 Level 内按文件名字母顺序加载** | ||
| - **category=SYSTEM 的插件先于 USER 插件加载** | ||
|
|
||
| --- | ||
|
|
||
| ## 启动流程图 | ||
|
|
||
| ``` | ||
| 按以下顺序加载 29 个插件: | ||
| ├─ Level 1 (最先) ──────────────────────────── | ||
| │ └─ fel-tokenizer-hanlp-plugin | ||
| │ | ||
| ├─ Level 4 (基础设施层) ────────────────────── | ||
| │ ├─ FEL 插件 (3个) | ||
| │ │ ├─ fel-tool-factory-repository | ||
| │ │ ├─ fel-tool-repository-simple | ||
| │ │ └─ fel-langchain-runnable | ||
| │ └─ FIT 内置插件 (20个,详见FIT文档) | ||
| │ | ||
| ├─ Level 5 (功能层) ────────────────────────── | ||
| │ └─ FEL 工具链 (4个) | ||
| │ ├─ fel-tool-discoverer | ||
| │ ├─ fel-tool-executor | ||
| │ ├─ fel-tool-mcp-client | ||
| │ └─ fel-tool-mcp-server | ||
| │ | ||
| └─ Level 7 (最后) ──────────────────────────── | ||
| └─ fel-model-openai-plugin | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## FEL插件清单(按启动顺序) | ||
|
|
||
| ### Level 1 - 第一批启动(1个插件) | ||
|
|
||
| | 序号 | 插件名称 | Category | 说明 | | ||
| |----|------------------------------|----------|-----------| | ||
| | 1 | `fel-tokenizer-hanlp-plugin` | user | HanLP 分词器 | | ||
CodeCasterX marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| **启动时机**: 应用启动后最先加载,提供基础分词功能。 | ||
|
|
||
| --- | ||
|
|
||
| ### Level 4 - 第二批启动(23个插件) | ||
|
|
||
| #### FEL 插件(3个) | ||
|
|
||
| | 序号 | 插件名称 | Category | 说明 | | ||
| |----|-------------------------------|----------|-----------------| | ||
| | 1 | `fel-langchain-runnable` | user | LangChain 运行时支持 | | ||
| | 2 | `fel-tool-factory-repository` | system | 工具工厂仓库 | | ||
| | 3 | `fel-tool-repository-simple` | system | 工具仓库(简单实现) | | ||
|
|
||
| #### FIT 内置插件(20个) | ||
|
|
||
| Level 4 还包含 20 个 FIT 框架内置插件(category=system),提供 HTTP 服务、序列化、验证、服务发现等核心功能。 | ||
|
|
||
| **FIT 插件详情**: 请参见 `framework/fit/java/fit-builtin/plugins/FIT插件启动顺序说明.md` | ||
|
|
||
| **加载顺序说明**: | ||
|
|
||
| - 先加载所有 category=SYSTEM 的插件(按文件名字母顺序) | ||
| - FIT 内置插件(20个,以 fit- 开头) | ||
| - FEL 工具仓库(2个) | ||
| - 再加载 category=USER 的插件 | ||
| - fel-langchain-runnable | ||
|
|
||
| --- | ||
|
|
||
| ### Level 5 - 第三批启动(4个插件) | ||
|
|
||
| | 序号 | 插件名称 | Category | 说明 | | ||
| |----|-----------------------|----------|---------| | ||
| | 1 | `fel-tool-discoverer` | system | 工具发现器 | | ||
| | 2 | `fel-tool-executor` | system | 工具执行器 | | ||
| | 3 | `fel-tool-mcp-client` | system | MCP 客户端 | | ||
| | 4 | `fel-tool-mcp-server` | system | MCP 服务端 | | ||
|
|
||
| **启动时机**: Level 4 的工具仓库加载完成后启动。这些插件依赖 Level 4 的 `fel-tool-repository-simple` 和 | ||
| `fel-tool-factory-repository`,提供工具发现、执行和 MCP 协议支持。 | ||
|
|
||
| --- | ||
|
|
||
| ### Level 7 - 最后启动(1个插件) | ||
|
|
||
| | 序号 | 插件名称 | Category | 说明 | | ||
| |----|---------------------------|----------|-------------| | ||
| | 1 | `fel-model-openai-plugin` | system | OpenAI 模型集成 | | ||
|
|
||
| **启动时机**: 所有基础设施和工具链加载完成后最后启动,确保环境完全就绪。 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,183 @@ | ||
| # FIT插件启动顺序说明 | ||
|
|
||
| ## 概述 | ||
|
|
||
| 本文档记录了 FIT Framework 内置插件的启动顺序。FIT 内置插件共定义了 **22 个**,其中: | ||
|
|
||
| - **20 个**会自动输出到 `build/plugins/` 目录 | ||
| - **2 个**不在 `build/plugins/` 目录中(需单独配置) | ||
|
|
||
| 所有 FIT 插件均配置为 **Level 4, category=system**,在应用启动的第二批加载。 | ||
CodeCasterX marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| --- | ||
|
|
||
| ## 自动添加的FIT插件(20个) | ||
|
|
||
| ### Level 4 - 自动加载的插件 | ||
|
|
||
| 这 20 个插件会在构建时自动复制到 `build/plugins/` 目录,按**文件名字母顺序**加载: | ||
|
|
||
| | 序号 | 插件名称 | 说明 | | ||
| |----|---------------------------------------|-------------------| | ||
| | 1 | `fit-actuator` | 监控端点 | | ||
| | 2 | `fit-client-http` | HTTP 客户端 | | ||
| | 3 | `fit-dynamic-plugin-directory` | 动态插件目录 | | ||
| | 4 | `fit-heartbeat-client` | 心跳客户端 | | ||
| | 5 | `fit-http-client-okhttp` | OkHttp 客户端 | | ||
| | 6 | `fit-http-handler-registry` | HTTP 处理器注册 | | ||
| | 7 | `fit-http-openapi3-swagger` | OpenAPI 3/Swagger | | ||
| | 8 | `fit-http-server-netty` | Netty HTTP 服务器 | | ||
| | 9 | `fit-logger` | 日志组件 | | ||
| | 10 | `fit-message-serializer-cbor` | CBOR 序列化 | | ||
| | 11 | `fit-message-serializer-json-jackson` | Jackson JSON 序列化 | | ||
| | 12 | `fit-security-simple` | 简单安全 | | ||
| | 13 | `fit-server-http` | HTTP 服务器 | | ||
| | 14 | `fit-service-coordination-locator` | 服务定位 | | ||
| | 15 | `fit-service-coordination-simple` | 简单服务协调 | | ||
| | 16 | `fit-service-discovery` | 服务发现 | | ||
| | 17 | `fit-service-registry` | 服务注册 | | ||
| | 18 | `fit-validation-hibernate-jakarta` | Jakarta 验证 | | ||
| | 19 | `fit-validation-hibernate-javax` | Javax 验证 | | ||
| | 20 | `fit-value-fastjson` | Fastjson 支持 | | ||
|
|
||
| --- | ||
|
|
||
| ## 需要手动添加的插件(2个) | ||
|
|
||
| 以下插件在源码中定义,但**不会自动输出**到 `build/plugins/` 目录,需要手动添加: | ||
|
|
||
| ### 1. fit-dynamic-plugin-mvn | ||
|
|
||
| | 属性 | 值 | | ||
| |--------------|-----------------------------------------------------------------| | ||
| | **插件名** | fit-dynamic-plugin-mvn | | ||
| | **Level** | 4 | | ||
| | **Category** | system | | ||
| | **源码路径** | `framework/fit/java/fit-builtin/plugins/fit-dynamic-plugin-mvn` | | ||
| | **说明** | Maven 动态插件加载器 | | ||
| | **用途** | 从 Maven 仓库动态加载插件 | | ||
|
|
||
| ### 2. fit-service-coordination-nacos | ||
|
|
||
| | 属性 | 值 | | ||
| |--------------|-------------------------------------------------------------------------| | ||
| | **插件名** | fit-service-coordination-nacos | | ||
| | **Level** | 4 | | ||
| | **Category** | system | | ||
| | **源码路径** | `framework/fit/java/fit-builtin/plugins/fit-service-coordination-nacos` | | ||
| | **说明** | Nacos 服务协调实现 | | ||
| | **用途** | 使用 Nacos 进行服务注册和发现 | | ||
|
|
||
| --- | ||
|
|
||
| ## 插件功能分类 | ||
|
|
||
| 虽然所有 FIT 插件都在 Level 4 启动,但它们提供不同类别的功能: | ||
|
|
||
| ### HTTP 服务相关(7个) | ||
|
|
||
| - `fit-client-http` - HTTP 客户端接口 | ||
| - `fit-http-client-okhttp` - OkHttp 客户端实现 | ||
| - `fit-http-handler-registry` - HTTP 处理器注册 | ||
| - `fit-http-openapi3-swagger` - OpenAPI 3 和 Swagger UI | ||
| - `fit-http-server-netty` - Netty HTTP 服务器实现 | ||
| - `fit-server-http` - HTTP 服务器接口 | ||
| - `fit-heartbeat-client` - 心跳客户端 | ||
|
|
||
| ### 序列化相关(3个) | ||
|
|
||
| - `fit-message-serializer-cbor` - CBOR 格式序列化 | ||
| - `fit-message-serializer-json-jackson` - JSON 格式序列化(Jackson) | ||
| - `fit-value-fastjson` - Fastjson 值支持 | ||
|
|
||
| ### 服务协调相关(5个,其中1个可选) | ||
|
|
||
| - `fit-service-coordination-locator` - 服务定位器 | ||
| - `fit-service-coordination-simple` - 简单服务协调实现(默认) | ||
| - `fit-service-coordination-nacos` - Nacos 服务协调实现(可选,不在 build/plugins) | ||
| - `fit-service-discovery` - 服务发现 | ||
| - `fit-service-registry` - 服务注册 | ||
|
|
||
| ### 验证和安全(3个) | ||
|
|
||
| - `fit-validation-hibernate-jakarta` - Jakarta Bean Validation | ||
| - `fit-validation-hibernate-javax` - Javax Bean Validation | ||
| - `fit-security-simple` - 简单安全实现 | ||
|
|
||
| ### 动态插件加载(2个,其中1个可选) | ||
|
|
||
| - `fit-dynamic-plugin-directory` - 从目录加载插件(默认) | ||
| - `fit-dynamic-plugin-mvn` - 从 Maven 仓库加载插件(可选,不在 build/plugins) | ||
|
|
||
| ### 其他(2个) | ||
|
|
||
| - `fit-actuator` - 应用监控端点 | ||
| - `fit-logger` - 日志组件 | ||
|
|
||
| --- | ||
|
|
||
| ## 源代码位置 | ||
|
|
||
| 所有 FIT 内置插件的源码位于:`framework/fit/java/fit-builtin/plugins/` | ||
|
|
||
| ``` | ||
| framework/fit/java/fit-builtin/plugins/ | ||
| ├── pom.xml # 父 POM,统一配置 level=4 | ||
| │ | ||
| ├── fit-actuator/ | ||
| ├── fit-client-http/ | ||
| ├── fit-dynamic-plugin-directory/ | ||
| ├── fit-dynamic-plugin-mvn/ # 不会自动输出到build/plugins | ||
| ├── fit-heartbeat-client/ | ||
| ├── fit-http-client-okhttp/ | ||
| ├── fit-http-handler-registry/ | ||
| ├── fit-http-openapi3-swagger/ | ||
| ├── fit-http-server-netty/ | ||
| ├── fit-logger/ | ||
| ├── fit-message-serializer-cbor/ | ||
| ├── fit-message-serializer-json-jackson/ | ||
| ├── fit-security-simple/ | ||
| ├── fit-server-http/ | ||
| ├── fit-service-coordination-locator/ | ||
| ├── fit-service-coordination-simple/ | ||
| ├── fit-service-coordination-nacos/ # 不会自动输出到build/plugins | ||
| ├── fit-service-discovery/ | ||
| ├── fit-service-registry/ | ||
| ├── fit-validation-hibernate-jakarta/ | ||
| ├── fit-validation-hibernate-javax/ | ||
| └── fit-value-fastjson/ | ||
| ``` | ||
|
|
||
| ### 父 POM 配置 | ||
|
|
||
| 所有 FIT 内置插件继承自 `fit-builtin/plugins/pom.xml`,该文件统一配置了: | ||
|
|
||
| ```xml | ||
|
|
||
| <build> | ||
| <plugins> | ||
| <plugin> | ||
| <groupId>org.fitframework</groupId> | ||
| <artifactId>fit-build-maven-plugin</artifactId> | ||
| <configuration> | ||
| <category>system</category> | ||
| <level>4</level> <!-- 所有子插件继承此配置 --> | ||
| </configuration> | ||
| <executions> | ||
| <execution> | ||
| <id>build-plugin</id> | ||
| <goals> | ||
| <goal>build-plugin</goal> | ||
| </goals> | ||
| </execution> | ||
| <execution> | ||
| <id>package-plugin</id> | ||
| <goals> | ||
| <goal>package-plugin</goal> | ||
| </goals> | ||
| </execution> | ||
| </executions> | ||
| </plugin> | ||
| </plugins> | ||
| </build> | ||
| ``` | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.