2025-11-17 16:39:26 +08:00
|
|
|
// Package constants define constant variable
|
|
|
|
|
package constants
|
|
|
|
|
|
2026-02-12 17:09:08 +08:00
|
|
|
// EvenvtType define event type
|
|
|
|
|
type EvenvtType int
|
|
|
|
|
|
2025-11-17 16:39:26 +08:00
|
|
|
const (
|
2026-02-12 17:09:08 +08:00
|
|
|
// EventGeneralHard define gereral hard event type
|
|
|
|
|
EventGeneralHard EvenvtType = iota
|
|
|
|
|
// EventGeneralPlatformSoft define gereral platform soft event type
|
|
|
|
|
EventGeneralPlatformSoft
|
|
|
|
|
// EventGeneralApplicationSoft define gereral application soft event type
|
|
|
|
|
EventGeneralApplicationSoft
|
|
|
|
|
// EventWarnHard define warn hard event type
|
|
|
|
|
EventWarnHard
|
|
|
|
|
// EventWarnPlatformSoft define warn platform soft event type
|
|
|
|
|
EventWarnPlatformSoft
|
|
|
|
|
// EventWarnApplicationSoft define warn application soft event type
|
|
|
|
|
EventWarnApplicationSoft
|
|
|
|
|
// EventCriticalHard define critical hard event type
|
|
|
|
|
EventCriticalHard
|
|
|
|
|
// EventCriticalPlatformSoft define critical platform soft event type
|
|
|
|
|
EventCriticalPlatformSoft
|
|
|
|
|
// EventCriticalApplicationSoft define critical application soft event type
|
|
|
|
|
EventCriticalApplicationSoft
|
2025-11-17 16:39:26 +08:00
|
|
|
)
|
|
|
|
|
|
2026-02-12 17:09:08 +08:00
|
|
|
// IsGeneral define fucn to check event type is general
|
|
|
|
|
func IsGeneral(eventType EvenvtType) bool {
|
|
|
|
|
return eventType < 3
|
|
|
|
|
}
|
2025-11-17 16:39:26 +08:00
|
|
|
|
2026-02-12 17:09:08 +08:00
|
|
|
// IsWarning define fucn to check event type is warn
|
|
|
|
|
func IsWarning(eventType EvenvtType) bool {
|
|
|
|
|
return eventType >= 3 && eventType <= 5
|
|
|
|
|
}
|
2025-11-17 16:39:26 +08:00
|
|
|
|
2026-02-12 17:09:08 +08:00
|
|
|
// IsCritical define fucn to check event type is critical
|
|
|
|
|
func IsCritical(eventType EvenvtType) bool {
|
|
|
|
|
return eventType >= 6
|
|
|
|
|
}
|
2025-11-17 16:39:26 +08:00
|
|
|
|
|
|
|
|
const (
|
2026-02-12 17:09:08 +08:00
|
|
|
// EventFromStation define event from station type
|
|
|
|
|
EventFromStation = "station"
|
|
|
|
|
// EventFromPlatform define event from platform type
|
|
|
|
|
EventFromPlatform = "platform"
|
|
|
|
|
// EventFromOthers define event from others type
|
|
|
|
|
EventFromOthers = "others"
|
2025-11-17 16:39:26 +08:00
|
|
|
)
|
2026-02-24 17:08:48 +08:00
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
// EventStatusHappended define status for event record when event just happened, no data attached yet
|
|
|
|
|
EventStatusHappended = iota
|
2026-05-08 16:19:12 +08:00
|
|
|
// EventStatusDataAttached define status for event record when event data attached, ready to be sent
|
2026-02-24 17:08:48 +08:00
|
|
|
EventStatusDataAttached
|
2026-05-08 16:19:12 +08:00
|
|
|
// EventStatusReported define status for event record when event reported to downstream, no matter it's successful or failed
|
2026-02-24 17:08:48 +08:00
|
|
|
EventStatusReported
|
2026-05-08 16:19:12 +08:00
|
|
|
// EventStatusConfirmed define status for event record when event confirmed by operator or CIM
|
2026-02-24 17:08:48 +08:00
|
|
|
EventStatusConfirmed
|
2026-05-08 16:19:12 +08:00
|
|
|
// EventStatusClosed define status for event record when event closed due to condition recovery or manual close
|
2026-02-24 17:08:48 +08:00
|
|
|
EventStatusClosed
|
|
|
|
|
)
|
2026-02-28 17:38:33 +08:00
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
// EventExchangeName define exchange name for event alarm message
|
|
|
|
|
EventExchangeName = "event-exchange"
|
|
|
|
|
// EventDeadExchangeName define dead letter exchange name for event alarm message
|
|
|
|
|
EventDeadExchangeName = "event-dead-letter-exchange"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
// EventUpDownRoutingKey define routing key for up or down limit event alarm message
|
2026-03-02 17:00:09 +08:00
|
|
|
EventUpDownRoutingKey = "event.#"
|
2026-02-28 17:38:33 +08:00
|
|
|
// EventUpDownDeadRoutingKey define dead letter routing key for up or down limit event alarm message
|
2026-03-02 17:00:09 +08:00
|
|
|
EventUpDownDeadRoutingKey = "event.#"
|
2026-02-28 17:38:33 +08:00
|
|
|
// EventUpDownQueueName define queue name for up or down limit event alarm message
|
|
|
|
|
EventUpDownQueueName = "event-up-down-queue"
|
|
|
|
|
// EventUpDownDeadQueueName define dead letter queue name for event alarm message
|
|
|
|
|
EventUpDownDeadQueueName = "event-dead-letter-queue"
|
|
|
|
|
)
|
2026-03-02 17:00:09 +08:00
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
// EventGeneralUpDownLimitCategroy define category for general up and down limit event
|
|
|
|
|
EventGeneralUpDownLimitCategroy = "event.general.updown.limit"
|
|
|
|
|
// EventWarnUpDownLimitCategroy define category for warn up and down limit event
|
|
|
|
|
EventWarnUpDownLimitCategroy = "event.warn.updown.limit"
|
|
|
|
|
// EventCriticalUpDownLimitCategroy define category for critical up and down limit event
|
|
|
|
|
EventCriticalUpDownLimitCategroy = "event.critical.updown.limit"
|
|
|
|
|
)
|
feat: add dedicated message-exchange for task lifecycle notifications
- add constants/message.go with MessageTask* categories and message-exchange /
message-queue / dead-letter routing constants
- add mq/publish_message.go with PushMessageToRabbitMQ (confirm mode,
dead-letter queue) separate from the existing event-exchange publisher
- add mq/emit.go with TryEmitMessage for non-blocking, OTel-traced dispatch
- add mq/event/task_event_gen.go with NewTaskSubmitted/Running/Completed/
Failed/CancelledMessage constructors
- wire TryEmitMessage into task worker and create/cancel handlers so all 5
lifecycle transitions are published (previously task.* routed to
event-exchange with no matching binding, causing silent drops)
- harden Dockerfile: scratch final image, pinned alpine:3.21 certs stage,
apk upgrade in builder, add -trimpath -mod=readonly go build flags
- add full K8s manifests under deploy/k8s/ for Redis, RabbitMQ (mTLS),
ModelRT (Downward API, scratch image, readOnlyRootFilesystem), Jaeger,
Loki, Promtail, Grafana
- expand deploy.md with async_task SQL schema, TLS cert generation steps,
K8s deployment procedures, and SSH tunnel configuration
2026-05-13 16:58:36 +08:00
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
// EventTaskGeneralTestCategory define category for test task event
|
|
|
|
|
EventTaskGeneralTestCategory = "event.general.task.test"
|
|
|
|
|
// EventTaskGeneralTopologyAnalyzeCategory define category for topology analyze task event
|
|
|
|
|
EventTaskGeneralTopologyAnalyzeCategory = "event.general.task.topology_analyze"
|
|
|
|
|
)
|