Files
Edu/services/msg/README.md
SpecialX beedbaf686 docs: 同步 P6 工作日志、runbook 与服务 README
- known-issues.md: 追加 9 条 P6 工作经验日志,更新 arch-scan 经验
- post-p6-followup.md: 新增 P6 后续工作手册 runbook
- iam/core-edu/content/msg README: 补充健康检查端点说明
2026-07-08 12:53:05 +08:00

53 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Msg 消息通知服务
> 版本0.1P5 骨架)
> 端口3007
## 职责
消息通知限界上下文,管理通知的多渠道分发(站内信、邮件、短信、推送)。
消费 Kafka 事件,写入 MySQL + Elasticsearch调用 Push Gateway 实时推送。
## 技术栈
- NestJS 10 + TypeScript 5
- Drizzle ORM + MySQL 8
- Elasticsearch 8全文检索
- Kafka事件消费骨架
- pino + prom-client + OpenTelemetry
## 开发
```bash
pnpm install
pnpm dev # http://localhost:3007
```
## API
| 方法 | 路径 | 说明 |
| ---- | ------------------------ | ---------------- |
| POST | /notifications | 发送通知 |
| GET | /notifications | 查询用户通知列表 |
| POST | /notifications/:id/read | 标记已读 |
| GET | /notifications/search?q= | 全文检索通知 |
## 健康检查
| 端点 | 用途 | 鉴权 |
| -------------- | ------------------------------------------------- | ---- |
| `GET /healthz` | 存活探针liveness仅返回进程状态不检查依赖 | 无 |
| `GET /readyz` | 就绪探针readiness检查 DB 连接,失败返回 503 | 无 |
实现见 `src/shared/health/health.controller.ts`5 个 NestJS 服务iam/core-edu/content/msg/classes一致。
## 环境变量
| 变量 | 默认值 | 说明 |
| ------------- | --------------------- | ------------------ |
| PORT | 3007 | 服务端口 |
| DATABASE_URL | - | MySQL 连接串 |
| KAFKA_BROKERS | localhost:9092 | Kafka broker 列表 |
| ES_URL | http://localhost:9200 | Elasticsearch 地址 |
| JWT_SECRET | - | JWT 密钥 |