一切皆为插件的开发者工具运行时框架
🧩 核心特性:
- 插件热插拔 (importlib 动态加载)
- 依赖自动解析 (拓扑排序 + 循环检测)
- 企业级稳定 (熔断/降级/重试/隔离)
- 事件驱动 (发布/订阅事件总线)
- 完整配置 (YAML 配置 + 热重载)
31 lines
629 B
Python
31 lines
629 B
Python
"""WebSocket API 插件入口 - 简化版"""
|
|
from oss.plugin.types import Plugin, register_plugin_type
|
|
|
|
|
|
class WsApiPlugin(Plugin):
|
|
"""WebSocket API 插件"""
|
|
|
|
def __init__(self):
|
|
self._running = False
|
|
|
|
def init(self, deps: dict = None):
|
|
"""初始化"""
|
|
print("[ws-api] 初始化完成")
|
|
|
|
def start(self):
|
|
"""启动"""
|
|
self._running = True
|
|
print("[ws-api] 已启动")
|
|
|
|
def stop(self):
|
|
"""停止"""
|
|
self._running = False
|
|
print("[ws-api] 已停止")
|
|
|
|
|
|
register_plugin_type("WsApiPlugin", WsApiPlugin)
|
|
|
|
|
|
def New():
|
|
return WsApiPlugin()
|