C++ Based OPC UA Client/Server/PubSub SDK  1.8.3.628
OPC UA PubSub Messaging Concept

The OPC UA Client/Server communication model defines already a subscription (see OPC UA Client/Server Subscription Concept) that allows OPC UA Clients to subscribe for changes of Variable Values or for Event notifications. The Client/Server subscription is specific to the client who created the subscription and ensures reliable one time delivery of data changes and events.

The OPC UA PubSub communication model provides an optimized Publish Subscribe model for use cases where the Client/Server Subscription does not fit. One use case is high speed and cyclic data communication, where reliability is not required. Another use case is offloading of data distribution to a large (unlimited) number of receivers (Subscribers).

In this model, the Publisher produces messages that are sent to a so called Message Oriented Middleware. This Message Oriented Middleware can be network infrastructure like switches if UDP multi-cast is used as transport protocol or could be a message broker if MQTT is used as transport protocol. The Publisher sends the messages independent of the number of Subscribers. Therefore the role of a Subscriber receiving messages is independent of the application that configures what the Publisher is sending. The number of possible Subscribers scales with the network infrastructure or the message broker infrastructure. It is independent of the Publisher.

PubSub Big Picture

The content of the exchanged messages is called DataSet. The DataSetMetaData describes the layout of the messages and can provide additional meta-data like units for the fields in the DataSet.

The selection of the input for the DataSet messages in the Publisher is called PublishedDataSet. The selection can be a list of Variable Values or the fields on an EventType.

A DataSetWriter in the Publisher creates DataSet messages either cyclically for list of Variables or in the case of an event if the DataSet is event based. Several DataSet messages can be combined into a network message. Network messages are sent from the Publisher to the middleware using one of the transport protocols.

Depending on the transport protocol, the DataSetMetaData can be transported in-line from the Publisher to the Subscriber. But in most configuration scenarios, the DataSetMetaData is provided to the Subscriber as part of the initial configuration.

Subscribers select or filter the DataSet message they are interested in. For UDP this is typically done based on a Publisher and DataSetWriter identification in the network message. In the case of MQTT this is typically done by subscribing to a MQTT topic where the Publisher sends the DataSet messages to.

The UADP message mapping provides an end-to-end security option that requires a security key server for the distribution of session keys. They are used for signing and encryption of messages.

The following figure shows the configuration model for OPC UA PubSub.

PubSub configuration model

A PubSub connection defines the used protocol and the network address for sending or receiving messages. In the case of a message broker, the address represents a TCP/IP connection to the broker endpoint. In the case of UDP, this could be an IP multi-cast group. The selected protocol defines also the protocol specific headers used for the sent messages.

A WriterGroup defines the timing and header settings for PubSub NetworkMessages sent by a Publisher. Such a NetworkMessage can contain one or more DataSetMessages for the DataSetWriters contained in the WriterGroup.

The DataSetWriter is linked to a PublishedDataSet that defines the source of the message content and the DataSetMetaData. In addition the DataSetWriter defines the header settings for the DataSetMessage.

The DataSetReader is the counterpart to a DataSetWriter on the Subscriber side. It defines the filter for the selection of the Publisher and DataSetWriter of interest. It also contains the SubscribedDataSet that defines the processing of the received data. The default processing is a mapping to target variables in the Subscriber address space.

OPC UA PubSub defines different transport protocol mappings like UDP and MQTT and different message mappings like UADP (UA Datagram Protocol) and JSON.

The different configuration objects have generic settings and typically also transport and message mapping specific settings.

The next chapter describes Discovery and Security Configuration.