Home/Tech Blog/Protocols and Access/Vending Machine MQTT Access: Theme Design and QoS Selection
Protocols and Access

Vending Machine MQTT Access: Theme Design and QoS Selection

From the shadow of the device to the issuance of instructions, explain how to divide the topic level, how to select the QoS, and how to handle offline messages.

2020-07-021 min read102 views14 shares
Vending Machine MQTT Access: Theme Design and QoS Selection

主题层级设计

推荐按「产品 / 设备 / 方向」三段划分:hotel/vend/{sn}/up 与 hotel/vend/{sn}/down。

批次指令使用 hotel/vend/broadcast,平台侧再按设备清单逐条下发,避免单点风暴。

QoS 选择

  • 指令下发:QoS 1,允许重复但不可丢
  • 状态上报:QoS 1,配合上行序列号去重
  • 心跳保活:QoS 0,降低成本

离线与重连

设备断线重连后先拉取一次全量影子,再恢复正常增量上报,避免平台状态漂移。

cleanSession=false 时要注意服务端会话过期时间,建议 24 小时。

上线前压测

用 500 台模拟设备并发上报,观察平台入库延迟与消息积压,作为容量基线。

Need a custom solution for your project?

From terminal selection, protocol docking to deployment delivery, the engineering team can provide complete proposals and quotations.