- 新增多个业务域的__init__.py模块文件,规范包导出结构 - 调整多个DTO文件的导入路径,统一模块组织方式 - 移除测试文件中多余的空行与导入语句 - 优化部分业务模块的包层级划分
67 lines
2.9 KiB
Python
67 lines
2.9 KiB
Python
"""应用服务层。
|
||
|
||
应用服务层是 ForcePilot v1.2 多渠道网关的编排层,负责:
|
||
- 用例编排:实现驱动端口用例,协调领域服务与管道执行;
|
||
- 管道装配:装配入站 / 出站 / 控制面管道的阶段序列;
|
||
- 事务边界:在管道或用例编排器中显式控制事务边界;
|
||
- 领域服务编排:调用 core 层领域服务完成业务流程,不在应用层重新实现业务规则。
|
||
|
||
应用层仅依赖契约层(yuxi.channels.contract)与领域核心层(yuxi.channels.core),
|
||
不得直接依赖 fastapi / sqlalchemy / redis / arq 等框架设施。
|
||
|
||
新增子包(从 framework/ 拆解迁移):
|
||
- ``extension/``:扩展点注册中心(StageSlot/EventSubscription/ConfigSource)+ EventBus + 7 个内置事件订阅者。
|
||
- ``lifecycle/``:插件生命周期编排(状态机、加载器、依赖解析、能力校验、生命周期管理器、PluginHost 实现)。
|
||
- ``health/``:健康检查实现(聚合器、渠道探测、诊断导出)。
|
||
- ``config/``:配置热更新注册表。
|
||
- ``circuit_breaker/``:渠道级熔断器。
|
||
- ``outbox/``:Outbox 后台任务(恢复扫描、重试 Worker、审计清理、配对过期)。
|
||
- ``executor/``:工具与消息操作执行器。
|
||
|
||
顶层导出:
|
||
- 5 个用例服务:``InboundMessageService`` / ``AdminMessageService`` /
|
||
``ChannelControlService`` / ``PluginLifecycleService`` / ``HealthCheckService``。
|
||
- 3 条管道:``InboundPipeline`` / ``OutboundPipeline`` / ``ControlPlanePipeline``。
|
||
- 3 个上下文:``InboundContext`` / ``OutboundContext`` / ``ControlPlaneContext``。
|
||
- 管道基础设施:``Pipeline`` / ``AppStage`` / ``FailureStrategy``。
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
from yuxi.channels.application.control_plane import ControlPlaneContext, ControlPlanePipeline
|
||
from yuxi.channels.application.control_plane.usecase import ChannelControlService
|
||
from yuxi.channels.application.messaging.context import (
|
||
InboundContext,
|
||
OutboundContext,
|
||
)
|
||
from yuxi.channels.application.messaging.pipeline import AppStage, FailureStrategy, Pipeline
|
||
from yuxi.channels.application.messaging.pipeline.inbound import InboundPipeline
|
||
from yuxi.channels.application.messaging.pipeline.outbound import OutboundPipeline
|
||
from yuxi.channels.application.messaging.usecase import (
|
||
AdminMessageService,
|
||
InboundMessageService,
|
||
)
|
||
from yuxi.channels.application.observability.usecase import HealthCheckService
|
||
from yuxi.channels.application.plugin.usecase import PluginLifecycleService
|
||
|
||
__all__ = [
|
||
# 用例服务(5 个)
|
||
"InboundMessageService",
|
||
"AdminMessageService",
|
||
"ChannelControlService",
|
||
"PluginLifecycleService",
|
||
"HealthCheckService",
|
||
# 管道(3 条)
|
||
"InboundPipeline",
|
||
"OutboundPipeline",
|
||
"ControlPlanePipeline",
|
||
# 上下文(3 个)
|
||
"InboundContext",
|
||
"OutboundContext",
|
||
"ControlPlaneContext",
|
||
# 管道基础设施
|
||
"Pipeline",
|
||
"AppStage",
|
||
"FailureStrategy",
|
||
]
|