eis/src/zmqp/zmqp_readme.md
Huamonarch 09b48b07e5 Add READMEs for all infrastructure services and overall project
- EIS_README.md: Overall project architecture, data flow, service inventory
- zmqp/zmqc_readme: ActiveMQ producer/consumer bridging ICE
- zcache_readme: Data cache hub with address mapping and type conversion
- zhd_readme: Real-time snapshot persistence to iHyperDB
- zinit_readme: DB2-to-shared-memory initialization service
- zsub/zudp/zdsf/rcv_readme: Data receiver layer for different on-site protocols
2026-05-09 12:13:00 +08:00

86 lines
3.0 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.

# zmqp — ActiveMQ 消息生产者
## 概述
zmqp 是 EIS 系统中的 **ActiveMQ 消息发布服务**。它作为 ICE→ActiveMQ 的桥接器,其他进程通过 ICE 调用 `SendDataShort`zmqp 将消息发布到 ActiveMQ Topic供外部系统消费。
## 进程架构
zmqp 是 PACE 平台组件,注册 ICE 端点 `"baosight/zmqp"`
```
eqpalg / zad / ztrk
│ ICE SendDataShort(eventNo, data)
┌──────────────────────────┐
│ zmqp │
│ │
│ ZmqpICEI::SendDataShort │
│ │ │
│ ├→ eventNo=911 ────→ ActiveMQ Topic: {UnitNo}_EIS_RuleTopic
│ ├→ eventNo=912 ────→ ActiveMQ Topic: {UnitNo}_EMS_TaskTopic
│ ├→ eventNo=601 ────→ ActiveMQ Topic: {UnitNo}_ems_eqpalg
│ ├→ eventNo=602 ────→ ActiveMQ Topic: {UnitNo}_ems_eqpstats
│ ├→ eventNo=101 ────→ ActiveMQ Topic: {UnitNo}_backToStaParams
│ └→ ...其他事件号 → 对应 Topic
│ │
└──────────────────────────┘
```
## ICE 接口
| 方法 | 说明 |
|------|------|
| `SendDataShort(eventNo, seq)` | 核心接口,根据 eventNo 将消息发布到对应的 ActiveMQ Topic |
| `SendDataLong` | 未实现 |
| `TimeNotify` | 调试用,向 `RuleTopic` 发送测试消息 |
## 事件号与 Topic 映射
| eventNo | 常量 | Topic 后缀 | 用途 |
|---------|------|-----------|------|
| 911 | `EV_MQP_EQPALGMON` | `_EIS_RuleTopic` | eqpalg-mon 报警信息 |
| 912 | `EV_MQP_EQPALGTASK` | `_EMS_TaskTopic` | eqpalg-task 计算结果 |
| 601 | `EV_MQP_EQPALG` | `_ems_eqpalg` | 设备算法消息 |
| 602 | `EV_MQP_EQPSTATS` | `_ems_eqpstats` | 设备统计信息 |
| — | `EV_MQP_ZONETRK` | `_zonetrk` | 区域跟踪 |
| — | `EV_MQP_TAGMSG` | `_tagmsg` | 标签消息 |
| — | `EV_MQP_ITEMTAG` | `_itemtag` | 测点标签 |
| — | `EV_MQP_PDILIST` | `_pdilist` | PDI 列表 |
| — | `EV_MQP_PDOLIST` | `_pdolist` | PDO 列表 |
| — | `EV_MQP_RULEMSG` | `_RuleTopic` | 规则消息 |
| 101 | — | `_backToStaParams` | 统计参数回传 |
所有 Topic 名称格式: `{UnitNo}_{suffix}`(如 `C308_EIS_RuleTopic`)。
## ActiveMQ 连接
- **库**: Apache ActiveMQ-CPP 3.9.3
- **配置**: 从 `CRGS` 配置文件读取 `[activemq]` 段的 `server` 属性
- **模式**: 默认使用 Topic`istopic=true`),非持久化投递
## 典型数据流
```
eqpalg 检测到报警
alarm_poster → ICE SendDataShort(911, alarm_json)
zmqp → ProducerMQ::Publish("{UnitNo}_EIS_RuleTopic", alarm_json)
ActiveMQ Broker → 外部系统Web UI / 第三方告警平台)
```
## 源文件
```
src/zmqp/
├── zmqp.cpp # PACE 组件入口
├── ZmqpICEI.cpp # ICE servant: 事件号→Topic 路由
└── ProducerMQ.cpp # ActiveMQ 生产者封装
```