How to Load XML-Specified QoS Settings
There are several ways to load XML QoS profiles into your application. In C, Traditional C++, Java and .NET, it's the singleton DomainParticipantFactory that loads these profiles. Applications using the Modern C++ API can create any number of instances of dds::core::QosProvider with different parameters to load different QoS profiles or, they can use the singleton QosProvider::Default(). The profiles configured in the default QosProvider are used when creating an Entity without a explicit QoS parameter.
Here are the various approaches, listed in load order:
- $NDDSHOME/resource/xml/NDDS_QOS_PROFILES.xml
This file is loaded automatically if it exists (not the default) and ignore_resource_profile in the PROFILE QosPolicy (DDS Extension) is FALSE (the default). NDDS_QOS_PROFILES.xml does not exist by default. However, NDDS_QOS_PROFILES.example.xml is shipped with the host bundle of the product; you can copy it to NDDS_QOS_PROFILES.xml and modify it for your own use. The file contains the default QoS values that will be used for all entity kinds. (First to be loaded)
- URL Groups in NDDS_QOS_PROFILES
URL groups (see URL Groups) separated by semicolons referenced by the environment variable NDDS_QOS_PROFILES are loaded automatically if they exist and ignore_environment_profile in PROFILE QosPolicy (DDS Extension) is FALSE (the default).
- <working directory>/USER_QOS_PROFILES.xml
This file is loaded automatically if it exists and ignore_user_profile in PROFILE QosPolicy (DDS Extension) is FALSE (the default).
- URL groups in url_profile
URL groups (see URL Groups) referenced by url_profile (in PROFILE QosPolicy (DDS Extension) ) will be loaded automatically if specified.
- XML strings in string_profile
The sequence of XML strings referenced by string_profile (in PROFILE QosPolicy (DDS Extension) ) will be loaded automatically if specified. (Last to be loaded)
You may use a combination of the above approaches.
The location of the XML documents (only files and strings are supported) is specified using URL (Uniform Resource Locator) format. For example:
- File Specification: file:///usr/local/default_dds.xml
- String Specification: str://"<dds><qos_library>…</qos_library></dds>"
If you omit the URL schema name, Connext DDS will assume a file name. For example:
- File Specification: /usr/local/default_dds.xml
Duplicate QoS profiles are not allowed. Connext DDS will report an error message in these scenarios. To overwrite a QoS profile, use QoS Profile Inheritance.
Several QoS profiles are built into the Connext DDS core libraries and can be used as starting points when configuring QoS for your Connext DDS applications. For details, see Configuring QoS with XML.
© 2018 RTI