feat: 添加回路名称字段并实现元数据缓存查询

在 RCU 事件处理中新增回路名称(loop_name)字段,用于标识具体设备回路。
- 在 rcu_action_events 表中添加 loop_name 字段
- 新增项目元数据缓存模块,每日从 temporary_project 表刷新房间与回路信息
- 处理消息时,根据 device_id、dev_addr 等字段查询缓存获取回路名称
- 若缓存未命中,则根据设备类型规则生成兜底名称
- 更新环境变量、文档及测试用例以适配新功能
This commit is contained in:
2026-02-02 19:43:49 +08:00
parent 0e6c5c3cc3
commit 4e0f5213db
12 changed files with 660 additions and 117 deletions

View File

@@ -12,6 +12,9 @@ Backend service for processing RCU action events from Kafka, parsing them, and s
- **Error Handling**: Redis List (`error_queue`) for failed messages + Retry mechanism
- **Output**: PostgreSQL Table (`rcu_action_events`)
## Features
- **Loop Name Enrichment**: Enriches event data with `loop_name` by matching `device_id` and `dev_addr` against metadata cached from `temporary_project` tables (refreshed daily).
## Configuration (Environment Variables)
The project is configured via `.env`. Key variables:
- **Kafka**: `KAFKA_BROKERS`, `KAFKA_TOPIC`, `KAFKA_SASL_USERNAME`, `KAFKA_SASL_PASSWORD`