modify: 统一插件风格
This commit is contained in:
+2
-1
@@ -54,7 +54,8 @@ curl "http://localhost:8000/api/v1/calc/count"
|
||||
1. **配置**:`config/workers/example/*.toml` — 定义每个端点的参数和响应结构
|
||||
2. **模型**:`models/pydantic.py` — 由 `gen_models` 根据 TOML 自动生成
|
||||
3. **路由**:`router/` 下每个文件实现一个 RPC 端点,使用 `@rpc_method` 装饰器
|
||||
4. **工厂**:`__init__.py` 中的 `create_workers` 初始化数据库并启动 Worker
|
||||
4. **入口**:`__init__.py` 的 `ExamplePlugin`(Plugin 基类)统一生命周期——`on_init` 初始化
|
||||
数据库并发布到 global_var,`create_workers` / `cleanup` 为其 bound method
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
MQTT 端点处理器 — 通过 MQTT 主题 chongming/example/add 调用
|
||||
|
||||
与 GET/POST 的 add 共用同一个 subject (example.add),
|
||||
通过 _method="MQTT" 区分。
|
||||
通过信封 meta.method="MQTT" 区分。
|
||||
"""
|
||||
import time
|
||||
|
||||
|
||||
Reference in New Issue
Block a user