OPC UA PubSub Connector
Overview
Section titled “Overview”The OPC UA PubSub connector implements the publish/subscribe pattern defined by the OPC UA PubSub specification (Part 14). It enables high-throughput, decoupled communication between OPC UA producers and consumers using one of two transport mappings:
- MQTT - JSON-encoded messages over MQTT/UDP for broker-based fan-out
- UADP - Binary UADP (UA Datagram Protocol) over UDP multicast for low-latency LAN distribution
Connector Types:
OpcuaPubSubReader- Listens for inbound PubSub messages and emits them as Meddle payloadsOpcuaPubSubWriter- Publishes Meddle payloads as PubSub messages
Features
Section titled “Features”- ✅ Two transports: MQTT (JSON) and UADP (binary multicast)
- ✅ Automatic decoding of both JSON and UADP wire formats
- ✅ UDP multicast group management with interface selection
- ✅ Optional publisher ID and dataset name filtering
- ✅ Decoupled producer/consumer (no point-to-point session needed)
- ✅ Built for high-frequency telemetry distribution
Basic Configuration
Section titled “Basic Configuration”OPC UA PubSub Reader
Section titled “OPC UA PubSub Reader”{ "type": "OpcuaPubSubReader", "config": { "transport": "uadp", "multicastAddr": "opc.udp://224.0.5.1:4840/eth0", "publisherId": "Publisher_1", "dataSetName": "TankFarmDataSet" }}{ "type": "OpcuaPubSubReader", "config": { "transport": "mqtt", "brokerUrl": "0.0.0.0:1883", "topic": "factory/line1", "publisherId": "Publisher_1", "dataSetName": "LineOneMetrics" }}OPC UA PubSub Writer
Section titled “OPC UA PubSub Writer”{ "type": "OpcuaPubSubWriter", "config": { "transport": "uadp", "multicastAddr": "opc.udp://224.0.5.1:4840/eth0", "publisherId": "Publisher_1", "dataSetName": "TankFarmDataSet" }}{ "type": "OpcuaPubSubWriter", "config": { "transport": "mqtt", "brokerUrl": "192.168.1.20:1883", "topic": "factory/line1", "publisherId": "Publisher_1", "dataSetName": "LineOneMetrics" }}Configuration Parameters
Section titled “Configuration Parameters”Transport
Section titled “Transport”The wire transport used for PubSub messages. Must be one of:
mqtt- JSON messages over UDP (broker-bridged in production)uadp- Binary UADP frames over UDP multicast
{ "transport": "uadp"}Broker URL (MQTT Transport)
Section titled “Broker URL (MQTT Transport)”Required when transport: mqtt. The address Meddle binds (reader) or sends to (writer).
{ "brokerUrl": "192.168.1.20:1883"}Format: host:port.
Notes:
- The reader binds a UDP listener on this address
- For the writer, this is the destination address that PubSub messages are sent to
Topic (MQTT Transport)
Section titled “Topic (MQTT Transport)”Optional logical topic identifier. Informational metadata included alongside dataset filtering.
{ "topic": "factory/line1"}Multicast Address (UADP Transport)
Section titled “Multicast Address (UADP Transport)”Required when transport: uadp. The IPv4 multicast group plus optional interface.
{ "multicastAddr": "opc.udp://224.0.5.1:4840/eth0"}Format: opc.udp://<host>:<port>/<interface>.
host:port- The multicast group and port (typically224.0.5.1:4840for OPC UA PubSub default)interface- Required network interface name (eth0,en0,lo0)
Why is interface required? UDP multicast joins are interface-scoped. Without a specified interface, the OS cannot reliably bind the multicast group, especially on macOS (lo0) and cloud VMs with multiple NICs.
Plain host:port (no scheme) is also accepted for backward compatibility but interface selection is highly recommended.
Publisher ID
Section titled “Publisher ID”Identifies the source of PubSub messages.
{ "publisherId": "Publisher_1"}Notes:
- Required on the writer (every published message is tagged with it)
- Optional on the reader (when set, only messages from this publisher are kept; when empty, all publishers are accepted)
DataSet Name
Section titled “DataSet Name”Identifies the logical dataset within a publisher.
{ "dataSetName": "TankFarmDataSet"}Notes:
- Optional on both reader and writer
- On the reader, acts as a filter when set
Wire Formats
Section titled “Wire Formats”JSON (MQTT Transport)
Section titled “JSON (MQTT Transport)”The MQTT transport emits messages in a standard JSON envelope:
{ "PublisherId": "Publisher_1", "Messages": [ { "DataSetName": "TankFarmDataSet", "Payload": { "tank_1_level": 78.4, "tank_2_level": 62.1, "pump_running": true } } ]}UADP (UADP Transport)
Section titled “UADP (UADP Transport)”The UADP transport emits binary frames following OPC UA Part 14 framing. The reader automatically detects UADP vs JSON content and decodes both. Each decoded UADP DataSet emits one Meddle payload.
Data Flow
Section titled “Data Flow”Reader
Section titled “Reader”Multicast / UDP → OpcuaPubSubReader → (decode JSON or UADP) → Meddle Payload(s)Multiple datasets in a single network message produce multiple Meddle payloads (one per dataset).
Writer
Section titled “Writer”Meddle Payload → OpcuaPubSubWriter → (encode JSON envelope) → UDP send → SubscribersThe writer always emits JSON for both transports. Each Write invocation produces exactly one network message.
Common Use Cases
Section titled “Common Use Cases”1. Decoupled Plant-Floor Telemetry Distribution
Section titled “1. Decoupled Plant-Floor Telemetry Distribution”A central PLC publishes process variables to a UADP multicast group; multiple Meddle subscribers consume them independently.
{ "type": "OpcuaPubSubReader", "config": { "transport": "uadp", "multicastAddr": "opc.udp://224.0.5.1:4840/eth0", "publisherId": "PLC_Master" }}2. MQTT-Bridged IoT Telemetry
Section titled “2. MQTT-Bridged IoT Telemetry”Bridge OPC UA PubSub to a JSON-friendly MQTT topic for ingestion into cloud platforms:
{ "type": "OpcuaPubSubReader", "config": { "transport": "mqtt", "brokerUrl": "0.0.0.0:1883", "topic": "factory/sensors", "dataSetName": "EnergyMeters" }}3. Edge Gateway Publishing Aggregated KPIs
Section titled “3. Edge Gateway Publishing Aggregated KPIs”After processing, publish aggregated KPIs as a single PubSub message:
{ "type": "OpcuaPubSubWriter", "config": { "transport": "uadp", "multicastAddr": "opc.udp://224.0.5.1:4840/eth0", "publisherId": "Edge_Gateway_1", "dataSetName": "PlantKPIs" }}Troubleshooting
Section titled “Troubleshooting”No Messages Received (UADP)
Section titled “No Messages Received (UADP)”Problem: Reader silently runs but never emits payloads
Solutions:
- Confirm the multicast group matches the publisher exactly (
224.0.5.1:4840) - Specify the interface in
multicastAddr(e.g./eth0) — auto-discovery is not reliable - Use a network sniffer like
tcpdump -i eth0 host 224.0.5.1 and port 4840to confirm packets are arriving - Verify multicast routing is enabled on switches/routers between publisher and subscriber
network interface is required
Section titled “network interface is required”Problem: UADP configuration is rejected at startup
Solutions:
- Update
multicastAddrto include the interface:opc.udp://224.0.5.1:4840/eth0 - On macOS the loopback interface is
lo0; on Linux it’slo. Check withifconfigorip addr
Publisher Filtered Out
Section titled “Publisher Filtered Out”Problem: Reader sees messages on the wire but emits none
Solutions:
- Check the
publisherIdfilter on the reader — when set, only messages from that publisher pass through. Clear it to accept all - Same goes for
dataSetName— when set, only matching datasets pass
UDP Port Already in Use
Section titled “UDP Port Already in Use”Problem: bind: address already in use
Solutions:
- Multiple readers on the same host must use distinct ports
- For UADP multicast, multiple processes on the same host can join the same group only if
SO_REUSEPORTis honored (Linux); on macOS only one binding per group+port is allowed per process
Decoding Errors
Section titled “Decoding Errors”Problem: ErrOpcuaPubSubDecode is raised on every message
Solutions:
- Check whether the publisher uses JSON or UADP — the reader auto-detects but malformed data fails both paths
- Inspect the publisher’s PubSub configuration: dataset content type must be a supported scalar or structure
- Verify the publisher and subscriber agree on encoding (the OPC UA Server’s PubSub config defines this)
Best Practices
Section titled “Best Practices”1. Use UADP for In-Plant Distribution
Section titled “1. Use UADP for In-Plant Distribution”UADP is faster and has lower overhead than JSON-over-MQTT. Use it whenever you control the network.
2. Use MQTT-JSON for Cross-Site Bridges
Section titled “2. Use MQTT-JSON for Cross-Site Bridges”JSON is portable and easy to debug. When messages must traverse the public internet or be consumed by non-OPC UA tools, MQTT-JSON is more pragmatic.
3. Always Set the Interface on UADP
Section titled “3. Always Set the Interface on UADP”Never rely on the OS to “guess” the right NIC. Multi-homed hosts and containers fail silently otherwise.
4. Filter at the Subscriber
Section titled “4. Filter at the Subscriber”publisherId and dataSetName filtering is server-side cheap and dramatically reduces downstream processing load.
5. Plan IP Multicast Carefully
Section titled “5. Plan IP Multicast Carefully”- Use the OPC UA Foundation’s reserved range (
224.0.5.0/24) - Coordinate with your network team — uncontrolled multicast can flood the LAN
- Test with
tcpdump/Wiresharkbefore going to production
Example Workflows
Section titled “Example Workflows”Plant-Wide Telemetry Fan-Out
Section titled “Plant-Wide Telemetry Fan-Out”PLC (Publisher) → UADP multicast 224.0.5.1:4840 │ ┌────────┼────────┬──────────────┐ ↓ ↓ ↓ ↓ OpcuaPubSubReader OpcuaPubSubReader OpcuaPubSubReader (Storage) (Dashboard) (Alerting) │ │ │ ↓ ↓ ↓ InfluxDb2Writer Chart Isa182 → AlertEdge-to-Cloud Bridge
Section titled “Edge-to-Cloud Bridge”ModbusReader → Reshape → OpcuaPubSubWriter (MQTT) → External Broker → Cloud SubscribersBridges legacy Modbus devices into the modern OPC UA PubSub ecosystem.
Related Connectors
Section titled “Related Connectors”- OPC UA - Classic OPC UA client/server protocol (point-to-point)
- MQTT v5 - Generic MQTT (non-OPC UA) PubSub
- Modbus - Bridge legacy devices into the PubSub fabric
- Reshape - Normalize field names before publishing
- InfluxDB v2 - Persist subscribed telemetry