Skip to main content

pubsub

OPC UA PubSub (OPC UA Part 14) sends data to a broker, so that MQTT clients get values without an OPC UA connection. The gateway publishes JSON messages to an MQTT broker. Only the mqtt-json transport exists. A published data set is a named list of variables. A data set writer sends one published data set. A writer group sends the messages of its writers at each publishingInterval:. The gateway does not start if a published field names a node that does not exist or is not a Variable, if a writer names an unknown data set, or if a name or an id is used twice.

Example​

pubsub:
publisherId: edge-01
publishedDataSets:
- name: Boiler
fields:
- name: Temperature
node: /ua:Objects/own:Boiler/own:Temperature
connections:
- name: PlantBroker
transport: mqtt-json
url: mqtt://broker.local:1883
writerGroups:
- name: Fast
writerGroupId: 1
publishingInterval: 1000
dataSetWriters:
- name: BoilerWriter
dataSetWriterId: 1
dataSet: Boiler

The value​

pubsub: is the PubSub settings.

The PubSub settings​

The publisher name, the data sets to publish and the brokers that receive them.

KeyWhat it doesValueRequired
publisherIdThe name of the gateway in each message (the PublisherId). Use a value that is unique on the broker. The default is the host name of the machine.text or whole number
publishedDataSetsThe data sets that the writers can send. Each data set is a named list of variables.list of published data set
connectionsThe brokers that receive the messages. Add one entry for each broker.list of PubSub connection

A published data set​

A named list of variables that the gateway sends together.

KeyWhat it doesValueRequired
nameThe name of the data set. A data set writer refers to it with dataSet:. The name must be unique.textyes
fieldsThe variables of the data set. Their order is the order in the message.list of published fieldyes

A PubSub connection​

One MQTT broker that receives the messages, and the writer groups that send to it.

KeyWhat it doesValueRequired
nameThe name of the connection. The name must be unique.textyes
urlThe URL of the broker, for example mqtt://broker.local:1883 or mqtts://broker.local:8883. To give a user name and a password, put them in the URL: mqtt://user:password@broker.local:1883.textyes
writerGroupsThe writer groups of the connection.list of writer groupyes
transportThe transport profile. Only mqtt-json exists: an MQTT broker and JSON messages.mqtt-json

A published field​

One variable of a published data set.

KeyWhat it doesValueRequired
nameThe key of the value in the JSON message.textyes
nodeThe variable to publish, as a browse path or a NodeId, as in mapping:. The node must exist and must be a Variable.textyes
samplingIntervalThe time in ms between two samples of the variable. The default is the publishingInterval of the writer group.number

A writer group​

A group of data set writers that send their messages at the same interval.

KeyWhat it doesValueRequired
nameThe name of the writer group.textyes
writerGroupIdThe number of the writer group in the messages. It must be unique in the connection.whole numberyes
dataSetWritersThe data set writers of the group. Add one writer for each data set to send.list of data set writeryes
publishingIntervalThe time in ms between two messages. The default is 1000.number
qosThe MQTT quality of service. atMostOnce (QoS 0) sends a message once, with no check. atLeastOnce (QoS 1) repeats it until the broker confirms. exactlyOnce (QoS 2) delivers it one time. The default is atMostOnce.atMostOnce, atLeastOnce, exactlyOnce
topicThe MQTT topic of the data messages of this group. A writer can set its own topic:. The default is opcua/json/data/<publisherId>/<writerGroupId>/<dataSetWriterId>.text

A data set writer​

The part of a writer group that sends one published data set.

KeyWhat it doesValueRequired
nameThe name of the data set writer.textyes
dataSetWriterIdThe number of the writer in the messages. It must be unique for the publisher.whole numberyes
dataSetThe name of the published data set that this writer sends.textyes
topicThe MQTT topic of the data messages of this writer. The default is the topic of the writer group.text