Skip to content

MQTT 5.0 · UADP

MQTT for OPC UA PubSub

MQTT 5.0 as the broker transport of OPC UA PubSub. The OPC UA simulator's GUI, headless program and MCP server publish and subscribe UADP messages through a broker.

What it does

  • Choose UADP over MQTT on the PubSub tab of the OPC UA simulator, or use the headless and MCP tools.
  • MQTT 5.0 over TCP: publish with QoS 1 and subscribe to the same topic.
  • Content type application/opcua+uadp and the UAMessageType user property.
  • UADP network messages of 1 to 64 fields, up to 64 KiB.
  • Publish and subscribe in one simulator to test with a single broker.

Example

MQTT has no SDK binding. These are the real scenario and command files that the OPC UA headless simulator (pdcomm-opcua-headless) runs, and the broker configuration of the tutorials.

PubSub over MQTT publisher scenario

Source: examples/mqtt-tutorial/publisher-scenario.json:1-42
[
  {
    "command": {
      "action": "configure",
      "config": {
        "pubsub": {
          "transport": "mqtt",
          "role": "publisher",
          "broker": "127.0.0.1:1883",
          "topic": "opcua/uadp/data/100/line1",
          "publisher_id": 100,
          "writer_group_id": 1,
          "dataset_writer_id": 1
        }
      }
    }
  },
  { "command": { "action": "pubsub_start" }, "expect": { "running": true, "transport": "mqtt" } },
  {
    "command": {
      "action": "pubsub_publish",
      "fields": [
        { "type": "Double", "value": 21.5 },
        { "type": "Boolean", "value": true },
        { "type": "String", "value": "RUN" }
      ]
    },
    "expect": { "sequence": 1 }
  },
  {
    "command": {
      "action": "pubsub_publish",
      "fields": [
        { "type": "Double", "value": 21.75 },
        { "type": "Boolean", "value": true },
        { "type": "String", "value": "RUN" }
      ]
    },
    "expect": { "sequence": 2 }
  },
  { "command": { "action": "pubsub_stop" }, "expect": { "running": false } }
]

The scenario file of the MQTT tutorial. pdcomm-opcua-headless --scenario publisher-scenario.json publishes two UADP messages to the broker and checks each step's result.