Files
Web_BLS_RCUAction_Server/openspec/project.md
XuJiacheng 4e0f5213db feat: 添加回路名称字段并实现元数据缓存查询
在 RCU 事件处理中新增回路名称(loop_name)字段,用于标识具体设备回路。
- 在 rcu_action_events 表中添加 loop_name 字段
- 新增项目元数据缓存模块,每日从 temporary_project 表刷新房间与回路信息
- 处理消息时,根据 device_id、dev_addr 等字段查询缓存获取回路名称
- 若缓存未命中,则根据设备类型规则生成兜底名称
- 更新环境变量、文档及测试用例以适配新功能
2026-02-02 19:43:49 +08:00

1.3 KiB

BLS RCU Action Server

Overview

Backend service for processing RCU action events from Kafka, parsing them, and storing them in PostgreSQL. Includes error handling via Redis and heartbeat monitoring.

Architecture

  • Input: Kafka Topic (blwlog4Nodejs-rcu-action-topic or configured via env)
  • Processing: Node.js Service
    • Consumer: kafka-node consumer group
    • Parser: Parses JSON messages, handles UDP raw data decoding
    • Database: PostgreSQL (Batch insert)
    • 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
  • Database: DB_HOST, DB_PORT, DB_USER, DB_PASSWORD, DB_DATABASE, DB_SSL
  • Redis: REDIS_HOST, REDIS_PORT, REDIS_PASSWORD

Development Constraints

  • Schema: Must strictly follow docs/readme.md.
  • Database: Do not alter Schema Name (rcu_action) or Table Name (rcu_action_events) unless explicitly requested.