eis/src/zmqc/zmqc_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

2.8 KiB
Raw Blame History

zmqc — ActiveMQ 消息消费者

概述

zmqc 是 EIS 系统中的 ActiveMQ 消息消费服务。它作为 ActiveMQ→ICE 的桥接器,监听 ActiveMQ 队列,将收到的消息通过 ICE 转发给对应的内部服务。

进程架构

zmqc 是 PACE 平台组件,注册 ICE 端点 "baosight/zmqc"

  ActiveMQ Broker
       │
       │ Queue: /queue/{UnitNo}_invokeModel
       │ Queue: /queue/{UnitNo}_eqpalg
       │ Queue: /queue/{UnitNo}_repair
       ▼
  ┌──────────────────────────┐
  │         zmqc              │
  │                           │
  │  启动 3 个 ConsumerMQ 线程  │
  │                           │
  │  tHDL4: invokeModel 队列  │──→ ICE SendDataShort(99999) → baosight/eqpalg-task
  │  tHDL2: eqpalg 队列      │──→ ICE SendDataShort(99999) → baosight/eqpalg-mon
  │  tHDL1: repair 队列      │──→ ICE SendDataShort(99999) → baosight/eqpm
  │                           │
  └──────────────────────────┘

三个监听线程

线程 ActiveMQ 目标 ICE 代理目标 用途
tHDL4 /queue/{UnitNo}_invokeModel baosight/eqpalg-task 外部触发算法单次执行
tHDL2 /queue/{UnitNo}_eqpalg baosight/eqpalg-mon 外部发送规则 CRUD 指令
tHDL1 /queue/{UnitNo}_repair baosight/eqpm 外部触发设备点检更新

ICE 接口

方法 说明
SendDataShort 空操作zmqc 不做 ICE 服务端处理)
SendDataLong 未实现
TimeNotify 未实现

zmqc 的核心逻辑在 ICE 客户端角色 — 它通过 ConsumerMQ 线程从 ActiveMQ 接收消息,然后调用其他 ICE 服务的 SendDataShort 转发。

ActiveMQ 连接

  • : Apache ActiveMQ-CPP 3.9.3
  • 配置: 从 CRGS 配置文件读取 [activemq] 段的 server 属性
  • 模式: 使用 Queue点对点模式

典型数据流

外部系统Web UI 触发单次执行)
    │
    ▼
ActiveMQ Queue: /queue/C308_invokeModel
    │
    ▼
zmqc ConsumerMQ 线程 → ICE SendDataShort(99999, json)
    │
    ▼
eqpalg-task → AlgorithmManager::dispose() → exec_task()

MQ 桥接总结

外部系统 ──ActiveMQ──→ zmqc ──ICE──→ 内部服务 (eqpalg/eqpm)
内部服务 ──ICE──→ zmqp ──ActiveMQ──→ 外部系统

zmqc + zmqp 共同构成了 ICE ↔ ActiveMQ 双向桥接

源文件

src/zmqc/
├── zmqc.cpp           # PACE 组件入口
├── ZmqcICEI.cpp       # ICE servant + 启动3个消费线程
└── ConsumerMQ.cpp     # ActiveMQ 消费者线程Topic/Queue 两种模式)