One of the use cases for PubSub is the publication of data to IT applications through a message queue where one DataSet is related to one message queue.

The IT application does not need to have knowledge about OPC UA but OPC UA specific header may be used for the message processing.

In such a use cases, the messages sent to a message queue can only contain one DataSetMessage but a OPC UA specific header is provided.

The header layout described in this section is optimized for this use case.

A single DataSet message has the following settings:

The header layout URI for the single DataSetMessage layout as specified in A.3.3.4 is

http://opcfoundation.org/UA/PubSub-Layouts/JSON-DataSetMessage

Table A.18 defines the values for the WriterGroup configuration parameters representing this layout.

Table A.18 – Values for WriterGroup configuration parameters

Parameter

Value

JsonNetworkMessageContentMask

0x00000006

This value results of the following options:

Bit 0: NetworkMessageHeader = 0

Bit 1: DataSetMessageHeader = 1

Bit 2: SingleDataSetMessage = 1

Bit 3: PublisherId = 0

Bit 4: DataSetClassId = 0

Bit 5: ReplyTo = 0

Bit 6: WriterGroupName = 0

Table A.19 defines the values for the DataSetWriter configuration parameters representing this layout.

Table A.19 – Values for DataSetWriter configuration parameters

Parameter

Value

JsonDataSetMessageContentMask

The mask allows the following options:

Bit 0: DataSetWriterId = 1

Bit 1: MetaDataVersion = 0

Bit 2: SequenceNumber = 1

Bit 3: Timestamp = 1

Bit 4: Status = 1

Bit 5: MessageType configurable (default is 0)

Bit 6: DataSetWriterName configurable (default is 0)

Bit 7: ReversibleFieldEncoding = 0

Bit 8: PublisherId = 1

Bit 9: WriterGroupName configurable (default is 0)

Bit 10: MinorVersion = 1

DataSetFieldContentMask

configurable (default is 0)

KeyFrameCount

configurable

If the KeyFrameCount is not 1, the MessageType bit shall be true.

Example for DataSet1 with all configurable JsonDataSetMessageContentMask flags set to false and no flags set for DataSetFieldContentMask.

{

"PublisherId":"MyPublisher",

"DataSetWriterId":101,

"SequenceNumber":68468,

"MinorVersion":672341762,

"Timestamp":"2021-09-27T18:45:19.555Z",

"Payload":

{

"Active":true,

"Temperature":25.5,

"Counter":0,

"AdditionalInfo":"The system is running normally (1)"

}

}

Example for DataSet2 with all configurable JsonDataSetMessageContentMask flags set to true and no flags set for DataSetFieldContentMask.

{

"PublisherId":"MyPublisher",

"DataSetWriterId":102,

"SequenceNumber":25460,

"MinorVersion":672341762,

"Timestamp":"2021-09-27T18:45:19.555Z",

"Status":1073741824,

"MessageType":"ua-keyframe",

"WriterGroupName":"WriterGroup1",

"DataSetWriterName":"Writer102",

"Payload":

{

"LocationName":"Building A",

"Coordinate":

{

"X":1,

"Y":0.2

},

"Measurements":

[

20030,

20020,

20010

]

}

}

Example for DataSet1 with all configurable JsonDataSetMessageContentMask flags set to false and with SourceTimestamp and StatusCode flags set in the DataSetFieldContentMask. The Status is omitted if the Code is 0.

{

"PublisherId":"MyPublisher",

"DataSetWriterId":101,

"SequenceNumber":68468,

"MinorVersion":672341762,

"Timestamp":"2021-09-27T18:45:19.555Z",

"Payload":

{

"Active":

{

"Value":true,

"Status":{"Code":1073741824,"Symbol":"Uncertain"},

"SourceTimestamp":"2021-09-27T11:32:38.349925Z"

},

"Temperature":

{

"Value":25.5,

"SourceTimestamp":"2021-09-27T11:32:38.349925Z"

},

"Counter":

{

"Value":0,

"SourceTimestamp":"2021-09-27T11:32:38.349925Z"

},

"AdditionalInfo":

{

"Value":"The system is running normally (1)",

"SourceTimestamp":"2021-09-27T11:32:38.349925Z"

}

}

}