feat(ingress): 实现 JDBC 信箱轮询、入站持久化与对拍测试 (U05)
This commit is contained in:
@@ -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 }
|
||||
}
|
||||
Reference in New Issue
Block a user