7. Usage
This chapter explains how to run Routing Service either from the distributed command-line executable or from a library.
7.1. Command-Line Executable
Routing Service runs as a separate application. The script to run the executable is in
<NDDSHOME>/bin
.
rtiroutingservice [options]
In this section we will see:
How to Start Routing Service (Starting Routing Service).
How to Stop Routing Service (Stopping Routing Service).
Routing Service Command-line Parameters (Routing Service Command-Line Parameters).
7.1.1. Starting Routing Service
To start Routing Service with a default configuration, enter:
$ NDDSHOME/bin/rtiroutingservice
> %NDDSHOME%\bin\rtiroutingservice
This command will run Routing Service indefinitely until you stop it. See Stopping Routing Service.
Table 7.1 describes the command-line parameters.
Note
To run Routing Service on a target system (not your host development platform), you must first select the target architecture. To do so, either:
Set the environment variable
CONNEXTDDS_ARCH
to the name of the target architecture. (Do this for each command shell you will be using.)Or set the variable
connextdds_architecture
in the filerticommon_config.[sh/bat]
to the name of the target architecture. (The file isresource/scripts/rticommon_config.sh
on Linux or macOS systems,resource/scripts/rticommon_config.bat
on Windows systems.) If theCONNEXTDDS_ARCH
environment variable is set, the architecture in this file will be ignored.
7.1.2. Stopping Routing Service
To stop Routing Service, press Ctrl-c. Routing Service will perform a clean shutdown.
7.1.3. Routing Service Command-Line Parameters
The following table describes all the command-line parameters available in
Routing Service. To list the available commands, run
rtiroutingservice -h
.
Parameter |
Description |
---|---|
-appName <string> |
Assigns a name to the execution of the Routing Service. |
-cfgFile <string> |
Semicolon-separated list of configuration file paths. |
-cfgName <string> |
Specifies the name of the Routing Service configuration to be loaded. |
-convertLegacyXml <string> |
Converts the legacy XML specified with |
-domainIdBase <int> |
Sets the base domain ID. |
-D<name>=<value> |
Defines a variable that can be used as an alternate replacement for
XML environment variables, specified in the form $(VAR_NAME). |
-heapSnapshotDir <dir> |
Specifies the output directory where the heap monitoring snapshots are dumped. |
-heapSnapshotPeriod <sec> |
Specifies the period at which heap monitoring snapshots are dumped. For example, Routing Service
will generate a heap snapshot every <sec>. Enables heap monitoring if > 0. |
-help |
Prints this help and exits. |
-identifyExecution |
Appends the host name and process ID to the service name provided with
the -appName option. This option helps ensure unique names for remote
administration and monitoring. |
-ignoreXsdValidation |
Loads the configuration even if the XSD validation fails. |
-licenseFile <path> |
Specifies the path to the license file, required for license-managed distributions. See How to use a License File with RTI Services. |
-listConfig |
Prints the available configurations and exits. |
-logFile <file> |
Redirects logging to the specified file. |
-logFormat <string> |
A mask to configure the format of the log messages for both the service and DDS.
|
-maxObjectsPerThread <int> |
Maximum number of thread-specific objects that can be created. |
-noAutoEnable |
Starts Routing Service in a disabled state. |
-pluginSearchPath |
<path> Specifies a directory where plug-in libraries are located. |
-remoteAdministrationDomainId <int> |
Enables remote administration and sets the domain ID for remote
communication. |
-remoteMonitoringDomainId <int> |
Enables remote monitoring and sets the domain ID for status publication. |
-skipDefaultFiles |
Skips attempting to load the default configuration files |
-stopAfter <int> |
Number of seconds the Routing Service runs before it stops. |
-verbosity <service_level>[:<dds_level>] |
Controls what type of messages are logged.
Default: |
-version |
Prints the Routing Service version number and exits. |
All the command-line parameters are optional; if specified, they override the values of their corresponding settings in the loaded XML configuration. See Configuration for the set of XML elements that can be overridden with command-line parameters.
7.2. Routing Service Library
Routing Service can be deployed as a library linked into your application on selected architectures (see Release Notes). This allows you to create, configure, and start Routing Service instances from your application.
To build your application, add the dependency with the Routing Service library under
<NDDSHOME>/lib/<ARCHITECTURE>
, where <ARCHITECTURE>
is a valid and
installed target architecture.
7.2.1. Example
struct RTI_RoutingServiceProperty property =
RTI_RoutingServiceProperty_INITIALIZER;
struct RTI_RoutingService * service = NULL;
/* initialize property */
property.cfg_file = "my_routing_service_cfg.xml";
property.service_name = "my_routing_service";
...
service = RTI_RoutingService_new(&property);
if(service == NULL) {
/* log error */
...
}
if(!RTI_RoutingService_start(service)) {
/* log error */
...
}
while(keep_running) {
sleep();
...
}
...
RTI_RoutingService_delete(service);
using namespace rti::routing;
ServiceProperty property;
uint32_t running_seconds = 60;
property.cfg_file("my_routing_service_cfg.xml");
property.service_name("my_routing_service");
try {
Service service(property);
service.start();
// Wait for 'running_seconds' seconds
std::this_thread::sleep_for(std::chrono::seconds(running_seconds));
} catch (const std::exception &ex) {
/* log error */
...
}
7.3. Operating System Daemon
See generic instructions in How to Run as an Operating System Daemon.