feat(push-gateway,msg): redis pubsub backplane for real-time notifications

M7: ADR-040 Redis Pub/Sub as state routing backplane

- push-gateway: remove Kafka consumer, add SSE endpoint

- SSE: subscribe to Redis user:{userId}:notify on connect

- msg: publish notifications to Redis Pub/Sub instead of HTTP push

- docker-compose: remove Kafka env from push-gateway
This commit is contained in:
SpecialX
2026-07-15 01:28:55 +08:00
parent a75527be80
commit 6af1aa0d82
14 changed files with 402 additions and 484 deletions

View File

@@ -359,6 +359,16 @@ func idempotentKey(eventID string) string {
return "edu:push:idempotent:" + eventID
}
// NotifyChannel returns the Redis Pub/Sub channel name for a user's real-time
// notification stream. M7 (ADR-040): msg service publishes notifications to
// this channel; realtime-gateway instances subscribe per-connection when a
// user connects via SSE.
//
// Channel naming: `user:{userId}:notify`
func NotifyChannel(userID string) string {
return "user:" + userID + ":notify"
}
// ParseUserChannel extracts the userID from a "edu:push:channel:user:<userID>"
// channel name. Returns empty string when the name does not match.
func ParseUserChannel(channel string) string {