Files
msgexchange-v2/src/main/kotlin/com/gzzn/omms/msgexchange/config/PipelineProps.kt
T

50 lines
2.0 KiB
Kotlin
Raw Normal View History

package com.gzzn.omms.msgexchange.config
import io.micronaut.context.annotation.ConfigurationProperties
import java.time.Duration
/**
* ACMA-8 参数表(v4)初值;阶段 0 现网基线校准。
* U03N02):Micronaut 要求嵌套配置类同样标注 @ConfigurationProperties,否则
* msgx.pipeline/schd/identity.* 全部静默回落 Kotlin 默认值。
*/
@ConfigurationProperties("msgx")
class PipelineProps {
var serviceName: String = "msgexchangeapi"
var registerEureka: Boolean = true
var pipeline: Pipeline = Pipeline()
var schd: Schd = Schd()
var identity: Identity = Identity()
@ConfigurationProperties("pipeline")
class Pipeline {
var pollInterval: Duration = Duration.ofSeconds(1) // KEEP 现役节奏
var claimBatch: Int = 50
var maxAttempts: Int = 5 // 处理/投递同值
var backoffMs: List<Long> = listOf(1000, 2000, 4000, 8000, 16000)
var backoffCapMs: Long = 60_000
var headDeadline: Duration = Duration.ofMinutes(10) // 最坏 HOL 上界(毒丸升级)
/** U07:启动即拉起 Pump/Dispatcher 循环(默认关——需要真实仓储或 msgx.stubs=true 才可安全开启)。 */
var autostart: Boolean = false
/** N28attempt ≤ 0(如 FAILED 未递增 attempts 的行)不得抛异常,取下界=首档退避。 */
fun backoffFor(attempt: Int): Long {
val index = (attempt - 1).coerceAtLeast(0)
return backoffMs.getOrNull(index)?.coerceAtMost(backoffCapMs) ?: backoffCapMs
}
}
@ConfigurationProperties("schd")
class Schd {
var flushPeriod: Duration = Duration.ofSeconds(3) // KEEP 现役节律
var flushLimit: Int = 500
}
@ConfigurationProperties("identity")
class Identity {
/** CONFIRM(矩阵 #11):SEQN 重置作用域确认前保持 false,计算集中此处(I3)。 */
var includeDayBoundary: Boolean = false
}
}