2026-10-28 21:54:35 +08:00
|
|
|
|
package rabbitmq
|
|
|
|
|
|
|
|
|
|
|
|
// 通知队列复用 like / comment / social 三个 exchange,但用单一路由键只订阅
|
|
|
|
|
|
// "需要提醒用户"的那一个动作:
|
|
|
|
|
|
//
|
|
|
|
|
|
// like.events --like.like--> notification.like
|
|
|
|
|
|
// comment.events --comment.publish--> notification.comment
|
|
|
|
|
|
// social.events --social.follow--> notification.social
|
|
|
|
|
|
//
|
|
|
|
|
|
// 与主队列的区别:主队列用通配键(like.* 等)收全部动作,因为 DB 需要同步
|
|
|
|
|
|
// 点赞与取消点赞两个方向;通知只关心"发生过",取关 / 删评论不需要推送。
|
2026-11-11 16:19:26 +08:00
|
|
|
|
// 关注没有 DB 同步队列:写库在 API 内完成,social.events 只承载通知。
|
2026-10-28 21:54:35 +08:00
|
|
|
|
//
|
|
|
|
|
|
// 这三个队列原先以字符串字面量写在 internal/http/router.go 里,导致
|
|
|
|
|
|
// rabbitmq 包与 http 包各存一份"线缆契约"。改为导出常量后,登记拓扑
|
|
|
|
|
|
// 与启动消费者共用同一份定义。
|
|
|
|
|
|
const (
|
|
|
|
|
|
NotificationLikeQueue = "notification.like"
|
|
|
|
|
|
NotificationCommentQueue = "notification.comment"
|
|
|
|
|
|
NotificationSocialQueue = "notification.social"
|
|
|
|
|
|
)
|