24 lines
797 B
Kotlin
24 lines
797 B
Kotlin
package com.gzzn.omms.msgexchange.ingress
|
|||
|
|
|
||
|
|
import com.gzzn.omms.msgexchange.infra.persistence.CminmsgInboxRepository
|
||
|
|
import jakarta.inject.Singleton
|
||
|
|
import java.time.Instant
|
||
|
|
|
||
|
|
/** ACMA-8 流程 1 · compat 写路径:HTTP 落信 + PG 入队(非生产主拓扑;主路径=InboxPoller JDBC 轮询)。 */
|
||
|
|
@Singleton
|
||
|
|
class InboxService(
|
||
|
|
private val inbox: CminmsgInboxRepository,
|
||
|
|
private val enqueue: InboxEnqueue,
|
||
|
|
) {
|
||
|
|
private val log = org.slf4j.LoggerFactory.getLogger(InboxService::class.java)
|
||
|
|
|
||
|
|
data class Receipt(val cminmsgsId: Long, val receivedAt: Instant)
|
||
|
|
|
||
|
|
fun accept(rawXml: String): Receipt {
|
||
|
|
val id = inbox.insertRaw(rawXml)
|
||
|
|
enqueue.enqueue(id)
|
||
|
|
log.info("compat-accepted cminmsgsId={}", id)
|
||
|
|
return Receipt(id, Instant.now())
|
||
|
|
}
|
||
|
|
}
|