fix: track live downstream cmpp connections

This commit is contained in:
hectorzhao
2026-07-11 19:16:52 +08:00
parent 76e0417ccf
commit 2fea15ef25
21 changed files with 477 additions and 141 deletions
+29
View File
@@ -40,6 +40,7 @@ model Tenant {
smsUplinkMessages SmsUplinkMessage[]
smsUplinkMatchCandidates SmsUplinkMatchCandidate[]
cmppDownstreamDeliveries CmppDownstreamDelivery[]
cmppDownstreamConnections CmppDownstreamConnection[]
cmppConnectionStates CmppConnectionState[]
gatewayDownstreamRecoveryStatuses GatewayDownstreamRecoveryStatus[]
gatewaySubmitDeadLetters GatewaySubmitDeadLetter[]
@@ -371,6 +372,7 @@ model SmsApplication {
uplinkMessages SmsUplinkMessage[]
uplinkMatchCandidates SmsUplinkMatchCandidate[]
downstreamDeliveries CmppDownstreamDelivery[]
downstreamConnections CmppDownstreamConnection[]
connectionStates CmppConnectionState[]
gatewayDownstreamRecoveryStatuses GatewayDownstreamRecoveryStatus[]
gatewaySubmitDeadLetters GatewaySubmitDeadLetter[]
@@ -550,6 +552,33 @@ model CmppConnectionState {
@@index([channelId, status])
}
model CmppDownstreamConnection {
id String @id @default(cuid())
tenantId String
applicationId String
account String
enterpriseCode String
connectionId String @unique
remoteIp String?
protocol String?
status String @default("connected")
connectedAt DateTime @default(now())
lastHeartbeatAt DateTime?
lastSubmitAt DateTime?
lastDeliverAt DateTime?
disconnectedAt DateTime?
lastError String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
tenant Tenant @relation(fields: [tenantId], references: [id])
application SmsApplication @relation(fields: [applicationId], references: [id])
@@index([applicationId, status, updatedAt])
@@index([tenantId, status, updatedAt])
@@index([account, status])
}
model SmsChannelGroup {
id String @id @default(cuid())
code String @unique