Glossary · PubSub

DataSetWriter

In OPC UA PubSub, a DataSetWriter publishes one PublishedDataSet into a WriterGroup. It owns the DataSetWriterId that identifies its messages on the wire, the field content mask that decides whether status and timestamps travel with each value, the KeyFrameCount, and any transport specifics such as an MQTT topic.

The four settings that change everything

DataSetWriterId is a UInt16 that must be unique within the group and is how a subscriber picks your messages out of a shared NetworkMessage. DataSetFieldContentMask selects whether each field is a bare raw value or a full DataValue with StatusCode, SourceTimestamp and ServerTimestamp. KeyFrameCount sets how many messages pass between full snapshots. DataSetName ties the writer to its dataset. Everything else is tuning.

RawData is cheap and loses your quality signal

With the content mask set to raw values only, a Double field is eight bytes and nothing else. That is the smallest and most deterministic form and it is what Ethernet and TSN deployments want. It also means the subscriber has no StatusCode, so a sensor failure, a substitute value and a genuine reading are byte-identical downstream. If quality matters, include the StatusCode, and remember that in JSON encoding Good is zero and is omitted, so an absent StatusCode means Good rather than missing.

On brokers, the writer is where topics are decided

For MQTT the writer carries its own transport settings including the queue or topic name and the metadata queue name, and metadata is published separately on its own topic with its own update rate rather than inline with every message. Products layer topic templates on top of this: OPC Publisher supports templates at WriterGroup, DataSetWriter or Node level, and can derive the topic hierarchy automatically from OPC UA browse paths starting at the root folder i=84, escaping MQTT reserved characters.

It has a state machine and it will refuse to start

Every PubSub object owns a state machine with a parent-to-child enable and disable cascade, and a primitive with invalid configuration stays disabled instead of publishing something wrong. A writer whose dataset was deleted, whose id collides, or whose group has no valid transport will sit in an error or disabled state. Read the state before assuming a network problem.

Example

One WriterGroup, two writers - note the distinct ids and the different key-frame policy

WriterGroup  "Line3_Fast"   PublishingInterval 100 ms   WriterGroupId 1
  DataSetWriter "Press"    DataSetWriterId 1
     DataSetName            Line3_Press
     DataSetFieldContentMask  RawData          # bare values, smallest frame
     KeyFrameCount            1                # every message is a full snapshot
  DataSetWriter "Counters" DataSetWriterId 2
     DataSetName            Line3_Counters
     DataSetFieldContentMask  StatusCode | SourceTimestamp
     KeyFrameCount            10               # 9 delta frames, then a key frame
The mistake people make: Cloning a publisher configuration onto a second machine and leaving the DataSetWriterIds and WriterGroupId unchanged. If both publish to the same multicast group or the same MQTT topic, subscribers accept both as the same writer, and you get two machines' values interleaved into one dataset with plausible timestamps.

Defined in: Part 14 - PubSub, DataSetWriter and DataSetWriter message settings.

Status codes you will meet

Last verified 7 September 2026 against OPC UA 1.05.07. OPC UA Connect is an educational resource and is not affiliated with the OPC Foundation.

Free download
OPC UA Server Acceptance Test Pack
A 40-check acceptance test you run against a vendor's server before commissioning sign-off. Weighted scoring, three hard gates, and a one-page verdict for the supplier meeting.
Get the free test pack →
Free, no course, no login