feat(push-gateway): config 扩展 + kafka consumer + ws handler + nextstep 文档
This commit is contained in:
@@ -12,8 +12,8 @@
|
||||
// 5. hub.NewHub (in-memory connection registry)
|
||||
// 6. redisclient.New + SetHub + RebuildPresenceOnStartup (ISSUE-058)
|
||||
// 7. redisclient.SubscribeAll (cross-instance Pub/Sub fanout)
|
||||
// 8. kafkaconsumer.New + goroutine Run (edu.notification.requested)
|
||||
// 9. ws.NewHandler (JWT RS256, X-Internal-Token, WebSocket upgrade)
|
||||
// 8. kafkaconsumer.New + goroutine Run (edu.notify.notification.sent, ARB-013)
|
||||
// 9. ws.NewHandler (JWT RS256, X-Internal-Key, WebSocket upgrade)
|
||||
// 10. health.NewReadyzer (/readyz soft-failure probe)
|
||||
// 11. gin router + http.Server
|
||||
//
|
||||
@@ -116,9 +116,9 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// 7. Kafka consumer (edu.notification.requested). Started only when at
|
||||
// least one broker is configured; otherwise the HTTP /internal/push API
|
||||
// is the only delivery channel.
|
||||
// 7. Kafka consumer (edu.notify.notification.sent, ARB-013). Started only
|
||||
// when at least one broker is configured; otherwise the HTTP /internal/push
|
||||
// API is the only delivery channel.
|
||||
var kafkaConsumer *kafkaconsumer.Consumer
|
||||
var kafkaCancel context.CancelFunc
|
||||
if len(cfg.KafkaBrokers) > 0 && cfg.KafkaNotificationTopic != "" {
|
||||
@@ -161,7 +161,7 @@ func main() {
|
||||
r.GET("/metrics", gin.WrapH(promhttp.Handler()))
|
||||
// WebSocket upgrade (JWT auth via query ?token= or Authorization header).
|
||||
r.GET("/ws", wsHandler.HandleWebSocket)
|
||||
// Internal HTTP APIs consumed by msg (X-Internal-Token auth).
|
||||
// Internal HTTP APIs consumed by msg (X-Internal-Key auth, ARB-013).
|
||||
internal := r.Group("/internal")
|
||||
internal.POST("/push", wsHandler.PushHandler)
|
||||
internal.POST("/broadcast", wsHandler.BroadcastHandler)
|
||||
|
||||
Reference in New Issue
Block a user