C++ Based OPC UA Client/Server/PubSub SDK
Starting points for users of the PubSub functionality

For the integration of PubSub into an OPC UA Server application, the application must load the PubSubManager as part of the Serer SDK start-up code. The necessary sample code can be found in the C++ SDK Demo Server in the file servermain.cpp.

The sample code shows how to configure the PubSubManager and how to add it as module to the server object.

// Create and initialize server object
OpcServer* pServer = new OpcServer;
pServer->setServerConfig(sConfigFileName, szAppPath);
// Create and initialize PubSub module
PubSubManager* pPubSubManager = new PubSubManager;
MyPubSubCallback pubSubCallback;
pPubSubManager->setPubSubConfig("pubsubconfig.uabinary", szAppPath);
// Start OPC UA Server with PubSub
ret = pServer->start();
if ( ret == 0 )

The PubSub configuration can be done on-line with an external PubSub configuration tool acting as OPC UA Client, or off-line by creating the PubSub configuration binary file in the UA binary format defined by the OPC UA specification. The creation of both an on-line and an off-line configuration is described in the Getting Started. See PubSub Configuration Options for a complete list of configuration options.

The access to the on-line PubSub configuration requires user authentication and authorization. The PublishSubscribe object with the current configuration and methods to modify the configuration can be found below the Server object. The object is visible for users with the Roles Anonymous and AuthenticatedUser. Changes to the configuration require a user with the role ConfigureAdmin. Sample code for user authentication can be found in the C++ SDK Demo Server in the part User Authentication

The UA PubSub Base Library provides a class library for creating and managing a PubSub configuration. The library is able to load and store the standard OPC UA PubSubConfiguration binary file.

The example PubSubImporter, used in Getting Started, provides an example for the use of the UA PubSub Base Library. The example imports a PubSub configuration from a simplified INI file and creates the PubSub configuration using the UA PubSub Base Library.

The following pages provide further information on the PubSub functionality in the SDK: