refactor(config): drop system-time defaults from domain and entry points
删除会被误用的系统时间默认值:MsgEvent.createdAt、ProcState.updatedAt、InboxPoller.pollOnce(now)、HistorySweepJob.run(now)、Identity.of(day)。Identity 的日期边界改由 MessageProcessor 按 PARAM:msgx.operation-day.zone 算出后传入(边界关闭时身份值不变);StubProcState/StubInbox 改注入 Clock(测试可传假时钟),全部调用点显式传时间。 验证:./gradlew test 145 tests / 0 fail / 0 skipped。
This commit is contained in:
@@ -3,6 +3,7 @@ package com.gzzn.omms.msgexchange.processing
|
||||
import com.gzzn.omms.msgexchange.codec.FlopPayload
|
||||
import com.gzzn.omms.msgexchange.codec.ScheduleBody
|
||||
import com.gzzn.omms.msgexchange.codec.XmlCodec
|
||||
import com.gzzn.omms.msgexchange.config.OperationDayProps
|
||||
import com.gzzn.omms.msgexchange.config.PipelineProps
|
||||
import com.gzzn.omms.msgexchange.domain.DecodedMessage
|
||||
import com.gzzn.omms.msgexchange.domain.ErrorClass
|
||||
@@ -18,6 +19,7 @@ import jakarta.inject.Singleton
|
||||
import java.time.Clock
|
||||
import java.time.Duration
|
||||
import java.time.Instant
|
||||
import java.time.LocalDate
|
||||
import java.util.concurrent.atomic.AtomicLong
|
||||
|
||||
/**
|
||||
@@ -147,6 +149,7 @@ class MessageProcessor(
|
||||
private val procFailure: ProcFailure,
|
||||
private val props: PipelineProps,
|
||||
private val clock: Clock,
|
||||
private val operationDayProps: OperationDayProps,
|
||||
) {
|
||||
private val log = org.slf4j.LoggerFactory.getLogger(MessageProcessor::class.java)
|
||||
|
||||
@@ -186,7 +189,9 @@ class MessageProcessor(
|
||||
|
||||
// I3:identity 仅首次绑定(head.identityKey == null);FAILED 重试不重绑
|
||||
if (head.identityKey == null) {
|
||||
val identity = Identity.of(decoded, props.identity)
|
||||
val identity = Identity.of(
|
||||
decoded, props.identity, LocalDate.now(clock.withZone(operationDayProps.zoneId())),
|
||||
)
|
||||
if (!procState.tryBindIdentity(head.msgId, identity)) {
|
||||
val owner = procState.ownerOfIdentity(identity) ?: -1L
|
||||
log.info("duplicate-of:{} -> SKIPPED msgId={}", owner, head.msgId)
|
||||
|
||||
Reference in New Issue
Block a user