MQTT in PDComm
PDComm offers MQTT as the broker transport of OPC UA PubSub. This page lists where you use MQTT and how it connects.
Where you use it
Section titled “Where you use it”You use MQTT through the OPC UA simulator programs.
| Path | Notes |
|---|---|
| PubSub tab of the OPC UA simulator GUI | Select UADP over MQTT in Transport. |
Headless simulator pdcomm-opcua-headless |
The same features through JSON-line commands such as pubsub_start. |
MCP server pdcomm-opcua-mcp |
The same features through MCP tools such as opcua_pubsub_start. |
All three simulator programs share one simulator service, so MQTT behaves the same whichever you use. To install and start the simulator package, follow the OPC UA documentation.
How it fits together
Section titled “How it fits together” OPC UA simulator MQTT broker OPC UA simulator (Role: Publisher) (e.g. Mosquitto) (Role: Subscriber)┌──────────────────┐ PUBLISH ┌──────────────┐ PUBLISH ┌──────────────────┐│ UADP DataSet │ QoS 1 ─▶│ topic │ QoS 1 ─▶│ decode UADP ││ NetworkMessage │◀─PUBACK─│ opcua/uadp/ │─PUBACK─▶│ Received table │└──────────────────┘ │ data/100/... │ └──────────────────┘ └──────────────┘ │ PUBLISH (any subscribed MQTT client, ▼ e.g. mosquitto_sub)With Role set to Publisher and subscriber, one simulator both publishes and subscribes. It receives its own messages back from the broker, so a single broker is enough to try it out.
Connection settings
Section titled “Connection settings”| Setting | Value |
|---|---|
| MQTT version | 5.0 |
| Transport | TCP. Reach a TLS broker through a TLS bridge. |
| Broker address | IP address:port, for example 127.0.0.1:1883 or [::1]:1883 |
| Authentication | None (anonymous) |
| Client Identifier | pdcomm-opcua-sim-<process ID>-<DataSetWriterId> |
| Session | Clean Start 1, Session Expiry Interval 0 |
| Keep Alive | 30 seconds, or the broker’s Server Keep Alive |
| Publishing | To the configured topic, QoS 1, RETAIN 0 |
| Subscription | One configured topic name, QoS 1 |
| Message properties | Content Type application/opcua+uadp, User Property UAMessageType = ua-data |
| Payload | An unsigned, unencrypted UADP NetworkMessage with 1 to 64 fields, at most 64 KiB |
| Maximum MQTT packet size | 128 KiB, or the broker’s Maximum Packet Size if smaller |
| Connect timeout | Timeout (ms) on the Connection & Security tab (client.timeout_ms), 5,000 ms by default |
| When the connection drops | PubSub stops and its status keeps the last error. Start PubSub again to reconnect. |
Which messages the subscriber accepts
Section titled “Which messages the subscriber accepts”A simulator subscriber accepts a message on its topic only when all of these hold:
- The Content Type is
application/opcua+uadp. - The User Property
UAMessageTypeisua-data. - The payload is an unsigned, unencrypted UADP NetworkMessage.
Any other message counts as rejected, and the last error in the status says why. Delivery problems explains each error value.
Identifiers in the UADP messages
Section titled “Identifiers in the UADP messages”Each NetworkMessage the simulator sends carries these identifiers.
Change them in the pubsub section of the configuration JSON.
| Configuration key | Default | UADP field |
|---|---|---|
publisher_id |
77 | PublisherId (UInt16) |
writer_group_id |
1 | WriterGroupId |
dataset_writer_id |
17 | DataSetWriterId |
OPC UA background explains PublisherId, WriterGroups and DataSetWriters.