-
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 all 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
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,118 @@ | ||
| # FEL插件启动顺序说明 | ||
|
|
||
| ## 概述 | ||
|
|
||
| 本文档记录了 FEL 插件的启动顺序。当应用以 JAR 包方式运行时,FIT 框架会按照 **Level**值从小到大的顺序加载这些插件。 | ||
|
|
||
| **build/plugins 插件统计**: | ||
|
|
||
| - **FEL 插件**: 9个(本文档详细说明) | ||
| - **FIT 内置插件**: 20个(详见 `framework/fit/java/fit-builtin/plugins/FIT插件启动顺序说明.md`) | ||
|
|
||
| **启动规则**: | ||
|
|
||
| - **category=SYSTEM (id=1) 的插件先于 USER (id=2) 插件加载** | ||
| - **相同 category 内,level 数值越小,启动优先级越高** | ||
| - **相同 category 和 level 的插件,加载顺序不确定** | ||
|
|
||
| **默认值**: | ||
|
|
||
| - 未指定 category 时,默认为 **category=USER** | ||
| - 未指定 level 时,默认为 **level=4** | ||
|
|
||
| --- | ||
|
|
||
| ## 启动流程图 | ||
|
|
||
| **启动顺序(两级排序:category → level)** | ||
|
|
||
| ``` | ||
| 插件启动顺序(29个插件) | ||
| │ | ||
| ├─ 阶段1: SYSTEM 插件启动 | ||
| │ │ | ||
| │ ├─ Level 4 (21个) | ||
| │ │ ├─ FIT 内置插件 (20个,详见FIT文档) | ||
| │ │ └─ fel-tool-repository-simple | ||
| │ │ | ||
| │ ├─ Level 5 (5个) | ||
| │ │ ├─ fel-tool-discoverer | ||
| │ │ ├─ fel-tool-executor | ||
| │ │ ├─ fel-tool-factory-repository | ||
| │ │ ├─ fel-tool-mcp-client | ||
| │ │ └─ fel-tool-mcp-server | ||
| │ │ | ||
| │ └─ Level 7 (1个) | ||
| │ └─ fel-model-openai-plugin | ||
| │ | ||
| └─ 阶段2: USER 插件启动 | ||
|
|
||
| ├─ Level 1 (1个) | ||
| │ └─ fel-tokenizer-hanlp-plugin | ||
| │ | ||
| └─ Level 4 (1个) | ||
| └─ fel-langchain-runnable | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| ## 插件依赖关系 | ||
|
|
||
| ### 启动时依赖 | ||
|
|
||
| | 依赖方插件 | 被依赖插件 | 依赖说明 | | ||
| |---------------------------------|----------------------------------------|--------------------------------------------| | ||
| | `fel-tool-discoverer` (Level 5) | `fel-tool-repository-simple` (Level 4) | 在 `onPluginStarted()` 回调时调用 `addTool()` 方法 | | ||
|
|
||
| --- | ||
|
|
||
| ## FEL插件清单 | ||
|
|
||
| ### 阶段1: SYSTEM 插件 | ||
|
|
||
| #### category=SYSTEM, level=4 (1个) | ||
|
|
||
| | 插件名称 | 说明 | | ||
| |------------------------------|------------| | ||
| | `fel-tool-repository-simple` | 工具仓库(简单实现) | | ||
|
|
||
| **FIT 内置插件**: Level 4 还包含 20 个 FIT 框架内置插件(category=SYSTEM),提供 HTTP 服务、序列化、验证、服务发现等核心功能。详见 | ||
| `framework/fit/java/fit-builtin/plugins/FIT插件启动顺序说明.md` | ||
|
|
||
| --- | ||
|
|
||
| #### category=SYSTEM, level=5 (5个) | ||
|
|
||
| | 插件名称 | 说明 | | ||
| |-------------------------------|---------| | ||
| | `fel-tool-discoverer` | 工具发现器 | | ||
| | `fel-tool-executor` | 工具执行器 | | ||
| | `fel-tool-factory-repository` | 工具工厂仓库 | | ||
| | `fel-tool-mcp-client` | MCP 客户端 | | ||
| | `fel-tool-mcp-server` | MCP 服务端 | | ||
|
|
||
| --- | ||
|
|
||
| #### category=SYSTEM, level=7 (1个) | ||
|
|
||
| | 插件名称 | 说明 | | ||
| |---------------------------|-------------| | ||
| | `fel-model-openai-plugin` | OpenAI 模型集成 | | ||
|
|
||
| --- | ||
|
|
||
| ### 阶段2: USER 插件 | ||
|
|
||
| #### category=USER, level=1 (1个) | ||
|
|
||
| | 插件名称 | 说明 | | ||
| |------------------------------|-----------| | ||
| | `fel-tokenizer-hanlp-plugin` | HanLP 分词器 | | ||
|
|
||
| --- | ||
|
|
||
| #### category=USER, level=4 (1个) | ||
|
|
||
| | 插件名称 | 说明 | | ||
| |--------------------------|-----------------| | ||
| | `fel-langchain-runnable` | LangChain 运行时支持 | |
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,208 @@ | ||
| # FIT插件启动顺序说明 | ||
|
|
||
| ## 概述 | ||
|
|
||
| 本文档记录了 FIT Framework 内置插件的启动顺序。FIT 内置插件共定义了 **22 个**,其中: | ||
|
|
||
| - **20 个**会自动输出到 `build/plugins/` 目录 | ||
| - **2 个**不在 `build/plugins/` 目录中(需单独配置) | ||
|
|
||
| 所有 FIT 插件均配置为 **category=SYSTEM, level=4**。 | ||
|
|
||
| --- | ||
|
|
||
| ## 启动顺序说明 | ||
|
|
||
| ### 整体启动阶段 | ||
|
|
||
| ``` | ||
| FIT 框架插件启动顺序 | ||
| │ | ||
| ├─ 阶段1: SYSTEM 插件启动 | ||
| │ │ | ||
| │ └─ Level 4 (20个自动输出 + 2个可选) | ||
| │ └─ FIT 内置插件 | ||
| │ | ||
| └─ 阶段2: USER 插件启动 | ||
| ``` | ||
|
|
||
| **FIT 内置插件均配置为 SYSTEM Level 4,为应用层插件提供基础服务。** | ||
|
|
||
| ### 启动规则 | ||
|
|
||
| - **category=SYSTEM (id=1) 的插件先于 USER (id=2) 插件加载** | ||
| - **相同 category 内,level 数值越小,启动优先级越高** | ||
| - **相同 category 和 level 的插件,加载顺序不确定** | ||
|
|
||
| **默认值**: | ||
| - 未指定 category 时,默认为 **category=USER** | ||
| - 未指定 level 时,默认为 **level=4** | ||
|
|
||
| --- | ||
|
|
||
| ## 自动添加的FIT插件 | ||
|
|
||
| 这 20 个插件会在构建时自动复制到 `build/plugins/` 目录(插件均配置为 category=SYSTEM, level=4): | ||
|
|
||
| | 序号 | 插件名称 | 说明 | | ||
| |----|---------------------------------------|-------------------| | ||
| | 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 支持 | | ||
|
|
||
| **注意**: 表格中的序号仅用于标识,不代表实际加载顺序。相同 category 和 level 的插件之间的加载顺序是不确定的。 | ||
|
|
||
| --- | ||
|
|
||
| ## 需要手动添加的插件 | ||
|
|
||
| 以下插件在源码中定义,但**不会自动输出**到 `build/plugins/` 目录,需要手动添加(插件均配置为 category=SYSTEM, level=4): | ||
|
|
||
| ### 1. fit-dynamic-plugin-mvn | ||
|
|
||
| | 属性 | 值 | | ||
| |----------|-----------------------------------------------------------------| | ||
| | **插件名** | fit-dynamic-plugin-mvn | | ||
| | **源码路径** | `framework/fit/java/fit-builtin/plugins/fit-dynamic-plugin-mvn` | | ||
| | **说明** | Maven 动态插件加载器 | | ||
| | **用途** | 从 Maven 仓库动态加载插件 | | ||
|
|
||
| ### 2. fit-service-coordination-nacos | ||
|
|
||
| | 属性 | 值 | | ||
| |----------|-------------------------------------------------------------------------| | ||
| | **插件名** | fit-service-coordination-nacos | | ||
| | **源码路径** | `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.