Using communication packages

From OPC Labs Knowledge Base
Revision as of 10:32, 13 December 2019 by User (talk | contribs)


Specifying the communication package

In order to select this communication package in OPC UA PubSub tools, you need to set a custom property on a PubSub connection as follows:

  • Property namespace: http://opclabs.com/OpcUA/PubSub
  • Property name: MessageChannel!
  • Property datatype: String
  • Property value: The type name of the message channel object. See the communication package documentation (example: OpcLabs.Mqtt.MqttClientMessageChannel,OpcLabs.Mqtt).

How this is done depends on the concrete software you are using.

EasyUASubscriber object

Usually, you will use the same communication package across your solution, but there is nothing that prevents you to use a different one with each PubSub connection, e.g. for compatibility reasons with different MQTT brokers.

OpcCmd tool

UADemoPublisher tool

In UADemoPublisher, you set the custom property on a PubSub connection using the --ConnectionProperties (-cp) option. They key is in the form {url}name, where url is the property namespace, and name is the property name. For example, to publish messages using the OpcLabs.Mqtt communication package, you can use the following command:

UADemoPublisher -mut -cp {http://opclabs.com/OpcUA/PubSub}MessageChannel!=OpcLabs.Mqtt.MqttClientMessageChannel,OpcLabs.Mqtt

As typing this in would be cumbersome, UADemoPublisher comes with several ready-made response files which contain the necessary settings for common MQTT communication packages. With the help of the response file, the command above can be shortened to:

UADemoPublisher -mut @MessageChannel-Mqtt

Since the command-line option name is the same as in the "uaSubscriber subscribeDataSet" or "uaSubscriber subscribeDataSetField" commands in the OpcCmd tool, the same response files can be used for communication package selection as with the OpcCmd tool.

Configuring the communication package