{
  "slug": "mqttjs-message-backpressure",
  "version": 1,
  "project": "mqttjs",
  "title": "MQTT.js callback-gated QoS 1 message handling",
  "description": "Two PUBLISH packets arrive together. MQTT.js emits message for packet 1 and invokes handleMessage. Callback 1 gates PUBACK 1 and handling packet 2; packet 2 follows the same event, handler, callback and acknowledgement sequence.",
  "config": {
    "design": "sequence-lifelines-ordered-labeled-messages",
    "name": "message-backpressure",
    "style": "clean",
    "palette": [
      "#467765"
    ],
    "parameters": {
      "participants": [
        {
          "id": "broker",
          "label": "Broker",
          "description": "Two incoming QoS 1 packets",
          "icon": "tabler:server"
        },
        {
          "id": "client",
          "label": "MQTT.js client",
          "description": "Handles one packet at a time",
          "icon": "tabler:arrows-exchange"
        },
        {
          "id": "app",
          "label": "Application",
          "description": "Overrides handleMessage",
          "icon": "tabler:code"
        }
      ],
      "messages": [
        {
          "from": "broker",
          "to": "client",
          "label": "PUBLISH 1 + PUBLISH 2"
        },
        {
          "from": "client",
          "to": "app",
          "label": "Emit 'message' for 1"
        },
        {
          "from": "client",
          "to": "app",
          "label": "handleMessage(1, callback)"
        },
        {
          "from": "app",
          "to": "client",
          "label": "Work finished: callback()",
          "kind": "reply"
        },
        {
          "from": "client",
          "to": "broker",
          "label": "PUBACK 1",
          "kind": "reply"
        },
        {
          "from": "client",
          "to": "app",
          "label": "Emit 'message' for 2"
        },
        {
          "from": "client",
          "to": "app",
          "label": "handleMessage(2, callback)"
        },
        {
          "from": "app",
          "to": "client",
          "label": "Work finished: callback()",
          "kind": "reply"
        },
        {
          "from": "client",
          "to": "broker",
          "label": "PUBACK 2",
          "kind": "reply"
        }
      ]
    },
    "accessibility": {
      "title": "MQTT.js callback-gated QoS 1 message handling",
      "description": "Two PUBLISH packets arrive together. MQTT.js emits message for packet 1 and invokes handleMessage. Callback 1 gates PUBACK 1 and handling packet 2; packet 2 follows the same event, handler, callback and acknowledgement sequence."
    }
  },
  "files": {
    "svg": {
      "url": "/diagram-sources/mqttjs-message-backpressure/v1/diagram.svg",
      "sha256": "6f17b18de6a8ac261c1b8159a5c3774ad8faae6b4354123d807e15b9f664c78e"
    },
    "png": {
      "url": "/diagram-sources/mqttjs-message-backpressure/v1/diagram.png",
      "sha256": "c4972fb62f54c40e1098cd06bcf28cbfbeb7a052d492b87f8d52fee5411daecf"
    }
  }
}
