Files
msgexchange-v2/src/main/kotlin/com/gzzn/omms/msgexchange/domain/MsgEvent.kt
T

34 lines
1.2 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.domain
/**
* ACMA-8 MSG_EVENT(统一投递事件 / outbox)。
* TARGET 阶段化:KAFKA:msg、KAFKA:schd 自阶段 AES:flight_hts、REDIS:flightInfo 仅阶段 B 投影期。
*/
object Targets {
const val KAFKA_MSG = "KAFKA:msg"
const val KAFKA_SCHD = "KAFKA:schd"
const val ES_FLIGHT_HTS = "ES:flight_hts"
const val REDIS_FLIGHT_INFO = "REDIS:flightInfo"
/** 阶段 A 投递目标(仅 Kafka)——I5Delivery 阶段 A 不写 Redis。 */
val phaseA: List<String> = listOf(KAFKA_MSG, KAFKA_SCHD)
/** 阶段 B 追加投影目标。 */
val phaseB: List<String> = phaseA + listOf(ES_FLIGHT_HTS, REDIS_FLIGHT_INFO)
}
enum class EventStatus { PENDING, SENT, DEAD }
data class MsgEvent(
val eventId: Long? = null,
val target: String,
val partitionKey: String? = null, // schd 事件恒为 FLIDv4 显式声明)
val payloadJson: String,
val state: EventStatus = EventStatus.PENDING,
val attempts: Int = 0,
val nextAttemptAt: java.time.Instant? = null,
val errorClass: ErrorClass? = null,
val lastError: String? = null,
val createdAt: java.time.Instant = java.time.Instant.now(),
)