C++ Based OPC UA Client/Server/PubSub SDK  1.7.6.537
Custom PubSub Message Handling

The PubSub Stack and SDK integration allows custom PubSub message handling. Such custom message handling is mainly necessary for real-time communication parts. Since the OPC UA server is typically running with lower priorities than real-time components, also the PubSub communication is executed in the same priority.

OPC UA PubSub has different transport profiles (message mapping and transport protocol mapping). Most of them do not need custom handling and the default SDK implementation can be used. Such an example is UADP over MQTT or UADP over UDP multi-cast.

If transport profile like UADP over Ethernet has stricter timing requirements, the communication needs typically higher priority and optimized processing. Such requirements can be fulfilled by doing the following custom implementations:

  • Custom data integration to encode the data to be sent by a DataSetWriter directly from the data source into the network message or to decode the data received by a DataSetReader directly from the network message to the data target.
  • Custom timing of WriterGroup for sampling and publishing of network message at the configured offsets
  • Custom network integration for optimized buffer management, prioritized sending and receiving of network messages

These three custom handlers are typically implemented together.

For the custom data integration and custom timing, the SDK provides a callback interface where the application is called for every PubSub object during the start-up of the PubSub configuration. For each DataSetWriter, DataSetReader and WriterGroup, the application can decided if it want to handle the processing instead of the default processing provided by the SDK. The callback interface PubSubServerApplicationCallback can be registered with PubSubManager::setPubSubServerApplicationCallback.

The C++ SDK Demo Server provides sample code for the implementation of the callbacks in the files myservercallback.h and myservercallback.cpp. The entry point is the class MyPubSubCallback that implements PubSubServerApplicationCallback.

For the custom network integration it is necessary to implement a user application specific PubSub network back-end. Such a PubSub network back-end must implement the interface PubSubBase::PubSubNetworkBackendInterfaceSdk.

The class implementing the user application specific network back-end must be derived from PubSubBase::PubSubNetworkBackendUser. The implementation can be registered with the PubSub module using PubSubManager::setPubSubNetworkBackendUser.