{
  "schema_version": 1,
  "diagram_type": "sequence",
  "meta": {
    "title": "设备下行闭环：回执沿上行链路处理",
    "locale": "zh-CN",
    "quality_profile": "showcase",
    "column_fit": "spread",
    "viewBox": [
      1360,
      600
    ]
  },
  "participants": [
    {
      "id": "hardware",
      "type": "external",
      "label": "设备"
    },
    {
      "id": "iot",
      "type": "cloud",
      "label": "腾讯 IoT"
    },
    {
      "id": "gateway",
      "type": "backend",
      "label": "gateway"
    },
    {
      "id": "device",
      "type": "backend",
      "label": "device 应用组件"
    },
    {
      "id": "device_worker",
      "type": "backend",
      "label": "device 处理器"
    },
    {
      "id": "insight",
      "type": "backend",
      "label": "insight"
    },
    {
      "id": "realtime",
      "type": "backend",
      "label": "realtime"
    },
    {
      "id": "app",
      "type": "frontend",
      "label": "App"
    }
  ],
  "messages": [
    {
      "id": "downlink-response_1",
      "from": "hardware",
      "to": "iot",
      "y": 160,
      "label": "设备协议回执",
      "variant": "dashed"
    },
    {
      "id": "downlink-response_2",
      "from": "iot",
      "to": "gateway",
      "y": 190,
      "label": "txmqtt/data 回调",
      "variant": "default"
    },
    {
      "id": "downlink-response_3",
      "from": "gateway",
      "to": "device",
      "y": 220,
      "label": "转发回调至 device",
      "variant": "default"
    },
    {
      "id": "downlink-response_4",
      "from": "device",
      "to": "device_worker",
      "y": 250,
      "label": "顺序交付与解析",
      "variant": "default"
    },
    {
      "id": "downlink-response_5",
      "from": "device_worker",
      "to": "insight",
      "y": 280,
      "label": "采集 source=app",
      "variant": "default"
    },
    {
      "id": "downlink-response_6",
      "from": "insight",
      "to": "device_worker",
      "y": 310,
      "label": "采集返回",
      "variant": "return"
    },
    {
      "id": "downlink-response_7",
      "from": "device_worker",
      "to": "device",
      "y": 340,
      "label": "设备状态投影",
      "variant": "default"
    },
    {
      "id": "downlink-response_8",
      "from": "device_worker",
      "to": "device",
      "y": 370,
      "label": "用户配置异步保存",
      "variant": "dashed"
    },
    {
      "id": "downlink-response_9",
      "from": "device_worker",
      "to": "realtime",
      "y": 400,
      "label": "按开关推送 type 7",
      "variant": "default"
    },
    {
      "id": "downlink-response_10",
      "from": "realtime",
      "to": "app",
      "y": 430,
      "label": "尽力投递",
      "variant": "dashed"
    },
    {
      "id": "downlink-response_11",
      "from": "device_worker",
      "to": "device",
      "y": 460,
      "label": "尝试水位后返回",
      "variant": "default"
    }
  ],
  "cards": [
    {
      "dot": "cyan",
      "title": "同一条入站通道",
      "items": [
        "device 验签后写入 Redis；分区消费者再调用 ResponseHandler。硬件回执不直接完成原控制 HTTP 请求。"
      ]
    },
    {
      "dot": "amber",
      "title": "默认开关",
      "items": [
        "设备消费者默认关闭；回执 type 7 推送的 YAML 默认值也为 false，不能把虚线当送达保证。"
      ]
    },
    {
      "dot": "rose",
      "title": "异常与持久化",
      "items": [
        "两个 device 参与者属同一进程，应用组件涵盖入口、状态及配置服务；路由返回才 ACK，异步保存不由 ACK 证明。"
      ]
    }
  ]
}
