Files
msgexchange-v2/src/main/kotlin/com/gzzn/omms/msgexchange/processing/Handler.kt
T
windyboy 7b7b61f100 feat(processing): 实现自有 PostgreSQL 运营航班权威存储与单事务闭环 (ACM2-28)
- FS1: 增加 Flyway 迁移 V1.1.0__flight_schd.sql,创建 FLIGHT_SCHD 与 SCHD_GEN
- FS2: 实现 FlightSchdRepository 接口及 JdbcFlightSchdRepository 与 StubFlightSchd,增强 JdbcOps 事务管理
- FS3: 扩展 MessageProcessor 事务 2 与按 FLID 点查视图,合并变更、事件与终态入单事务提交
- FS4: SnapshotFlow SQL 化(批处理 upsert、域内差删、SQL CAS 推进与熔断保护),JobExecutor 接入 PG 清场删除
- FS5: 彻底退役 Redis 权威与写路径,移除 FlightRedisClient、Lua 脚本、健康指示器与配置残留
- FS6: 补齐 U09/U29 不变量门禁(崩溃幂等、CAS 防并发、ADFT 存活保障、非 UTC JVM/会话时区无漂移)与 FlywayMigrationTest
- FS7: 交付影子对拍比较内核 FlightStoreDiffTool 与单元测试
- FS8: 全面回改 decision-flight-state、architecture、design、user-stories 权威文档与规范
2026-09-07 16:12:00 +08:00

35 lines
1.3 KiB
Kotlin
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package com.gzzn.omms.msgexchange.processing
import com.gzzn.omms.msgexchange.domain.DecodedMessage
import com.gzzn.omms.msgexchange.domain.Decision
import com.gzzn.omms.msgexchange.domain.MsgKind
/**
* ACMA-8 流程 2Handler = 纯函数(状态与报文进,Decision 出,不碰 Redis/Kafka)。
* 32 个 Handlerflop 29 + schd 3)翻译属阶段 2/3,逐条对照 ACMA-4 基线与兼容矩阵 KEEP/FIX。
*/
interface Handler {
val kind: MsgKind
/** 在线状态以只读视图传入(阶段 A 点查自有 PG FLIGHT_SCHD,由调用方装配,ACM2-28 定案)。 */
fun decide(flightView: Map<String, String>, msg: DecodedMessage): Decision
}
/**
* sealed 穷尽分派(ACMA-6 选型:取代 legacy 反射 get{TYPE}())。
*/
class HandlerRegistry(handlers: List<Handler>) {
private val byKind: Map<String, Handler> = handlers.associateBy { keyOf(it.kind) }
fun dispatcherFor(msg: DecodedMessage): Handler? = byKind[keyOf(msg.kind)]
companion object {
fun keyOf(kind: MsgKind): String = when (kind) {
is MsgKind.Schd -> "SCHD-${kind.subtype.name}"
is MsgKind.Flop -> "FLOP-${kind.subtype}"
}
}
}
// TODO(阶段2/3): 注册 3+29 Handler;本阶段仅含骨架(阶段 2 最小纵向链路先做 1 SCHD(DNLD) + 1 FLOP)。