Files
msgexchange-v2/src/main/kotlin/com/gzzn/omms/msgexchange/processing/RefDataCommit.kt
T
windyboyandCursor e5449a5cb1 feat(refdata): Q22 basicdata 映射与 ReferenceDataProcessor(ACM2-93)
闭合 Q22;V6 建 basicdata 表组;RefData 走真处理器(DNLD/RESP/ADD/UPD/DEL/RSTA)。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-21 16:01:06 +08:00

29 lines
1.0 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.ProcState
import com.gzzn.omms.msgexchange.domain.ProcStatus
import com.gzzn.omms.msgexchange.infra.persistence.PipelineLockRepository
import com.gzzn.omms.msgexchange.infra.persistence.PipelineTransactionManager
import com.gzzn.omms.msgexchange.infra.persistence.ProcStateRepository
import jakarta.inject.Singleton
import java.time.Clock
/** 静态参考数据单事务提交:落库 + 终态 + 回填意图(无 Redis / MSG_EVENT`US-13`)。 */
@Singleton
class RefDataCommit(
private val txManager: PipelineTransactionManager,
private val lock: PipelineLockRepository,
private val procState: ProcStateRepository,
private val clock: Clock,
) {
fun commit(head: ProcState, work: () -> Unit) {
lock.holdAcrossTransactions {
txManager.inTransaction {
lock.lock()
work()
procState.markTerminal(head.msgId, ProcStatus.SUCCEEDED, now = clock.instant())
}
}
}
}