feat(ingress): 实现 JDBC 信箱轮询、入站持久化与对拍测试 (U05)

This commit is contained in:
windyboy
2026-09-07 15:11:33 +08:00
parent dc68f1e1f8
commit c7b4b527ef
51 changed files with 1005 additions and 235 deletions
@@ -0,0 +1,22 @@
package com.gzzn.omms.msgexchange.delivery
import com.gzzn.omms.msgexchange.domain.MsgEvent
import com.gzzn.omms.msgexchange.domain.SchdPush
/**
* ACMA-8 流程 3 flushSchd 聚合(纯函数,可单测):
* 按 PARTITION_KEY(=FLID) 分组、组内取 EVENT_ID 最大——v4 显式 max(EVENT_ID)
* 不依赖集合遍历序(FIX:现役 buffer 无去重会重复投递旧值)。
*/
object SchdAggregation {
fun latestPerFlight(pending: List<MsgEvent>): List<String> =
pending
.groupBy { it.partitionKey ?: "" }
.map { (_, evs) -> evs.maxBy { it.eventId ?: 0 }.payloadJson }
/** 由 Decision 直接构造时的等价聚合(测试与 dispatcher 共用语义)。 */
fun latestPerFlightOfPush(pushes: List<SchdPush>): List<String> =
pushes
.groupBy { it.flid }
.map { (_, ps) -> ps.maxBy { it.eventSeq }.fltrJson }
}