5.2. Converter Configuration¶
When you start Converter, you can specify a configuration file in XML format. In this file, you can specify the properties that control the behavior of the service. This section describes how to write a configuration file.
5.2.1. How to Load the XML Configuration¶
Converter loads its XML configuration from multiple locations. Here are the various sources of configuration files, listed in load order:
[working directory]/USER_CONVERTER.xml
This file is loaded automatically if it exists.[NDDSHOME]/resource/xml/RTI_CONVERTER.xml
This file is loaded automatically if it exists.- One or more files (semicolon-separated) specified using the command-line parameter -cfgFile.
Note
[working directory]
indicates the path to the current working
directory from which you run Converter.
[NDDSHOME]
indicates the path to your Connext DDS installation.
See Section 1.3.
You may use a combination of the above sources and load multiple configuration files.
Here is an example configuration file. You will learn the meaning of each line as you read the rest of this section.
<?xml version="1.0" encoding="UTF-8"?>
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://community.rti.com/schema/6.0.0/rti_converter.xsd">
<!-- Available types -->
<types />
<!-- A definition of a Converter instance to run -->
<converter name="defaultToJson">
<!-- Input storage settings -->
<input_storage>
<sqlite>
<storage_format>XCDR_AUTO</storage_format>
<database_dir>cdr_recording</database_dir>
</sqlite>
</input_storage>
<!-- Output storage settings -->
<output_storage>
<sqlite>
<storage_format>JSON_SQLITE</storage_format>
<fileset>
<workspace_dir>converted</workspace_dir>
<filename_expression>rti_recorder_default.converted.dat</filename_expression>
</fileset>
</sqlite>
</output_storage>
<!-- Domain selection: assume 0 by default.
Converter is not a DDS application, so this won't create a
DDS Domain Participant, but allows you to select which domains
to convert -->
<domain_participant name="Domain0">
<domain_id>0</domain_id>
</domain_participant>
<session name="DefaultSession"
default_participant_ref="Domain0">
<!-- Topics to convert in this session -->
<topic_group name="DefaultTopicGroup">
<!-- Rules describing the topics to convert -->
<allow_topic_name_filter>*</allow_topic_name_filter>
<deny_topic_name_filter>rti/*</deny_topic_name_filter>
</topic_group>
</session>
</converter>
</dds>
5.2.2. XML Syntax and Validation¶
The XML representation of DDS-related resources must follow these syntax rules:
- It shall be a well-formed XML document according to the criteria defined in clause 2.1 of the Extensible Markup Language standard.
- It shall use UTF-8 character encoding for XML elements and values.
- It shall use
<dds>
as the root tag of every document.
To validate the loaded configuration, Converter relies on an XSD file that describes the format of the XML content. We recommend including a reference to this document in the XML file that contains the service’s configuration; this document provides helpful features in code editors such as Visual Studio®, Eclipse®, and NetBeans®, including validation and auto-completion while you are editing the XML file.
The XSD definitions of the XML elements are in $NDDSHOME/resources/schema/rti_converter.xsd
.
To include a reference to the XSD document in your XML file, use the
attribute xsi:noNamespaceSchemaLocation
in the <dds>
tag. For example:
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../schema/rti_converter.xsd">
<!-- ... -->
</dds>
5.2.3. Builtin Configuration of Converter¶
Converter comes pre-configured with a configuration that converts a file called rti_recorder_default.dat from XCDR format to a file called rti_recorder_default_converted.dat in JSON_SQLITE format. See Section 5.2.20 for details.
5.2.4. XML Tags for Configuring Converter¶
This section describes the XML tags you can use in a Converter
configuration file. Figure 5.1
and Table 5.2 describe
the top-level tags allowed within the root <dds>
tag.
Tags within <dds> | Description | Multiplicity |
---|---|---|
<types> | Defines types that can be used by Converter. This tag is needed if data types are not available in the discovery table. The type description is done using the Connext DDS XML format for type definitions. See Creating User Data Types with Extensible Markup Language (XML), in the RTI Connext DDS Core Libraries User’s Manual. | 0..* |
<plugin_library> | Contains a list of storage libraries that you may have implemented to support custom databases. For more information, see Section 3.2.14 and Section 4.2.17. | 0..* |
<converter> | Required.
See Section 5.2.5. |
1..* |
5.2.5. Converter Tag¶
A configuration file must have at least one <converter>
tag.
This tag is used to configure an execution of Converter.
A configuration file may contain multiple <converter>
tags.
When you start Converter, you can specify which
<converter>
tag to use to configure the service using the
-cfgName
command-line parameter. This means one file can
be used to configure multiple Converter executions.
Figure 5.2 and Table 5.3
describe the tags allowed within a <converter>
tag.
Tags within <converter> | Description | Multiplicity |
---|---|---|
<input_storage> | Describes the storage that Converter will read as input. Converter expects the storage to be in CDR (binary) format. If storage is not specified, data will be stored in a SQLite file using a default name. See Section 5.2.6. |
0..1 |
<output_storage> | Describes the storage that Converter will write as output. This output will be in JSON format. If this storage is not specified, data will be stored in a SQLite file using a default name. See Section 5.2.7. |
0..1 |
<data_selection> | Enables selection of a subset of data to convert. Supports selecting data for conversion by time (or tagged time). See Section 5.2.14. | 0..1 |
<session> | Allows you to create one or more sessions in which to convert data, which gives you the option of specifying multiple threads for conversion. See Section 5.2.17.
|
0..* |
<domain_participant> | Required.
|
1..* |
5.2.5.1. Example: Specify a Configuration in XML¶
<dds>
<converter name="ConvertToJSON">
<!-- ... Required entities -->
</converter>
</dds>
Starting Converter with the following command will use the
<converter>
tag with the name “ConvertToJSON”.
$NDDSHOME/bin/rticonverter -cfgFile file.xml -cfgName ConvertToJSON
5.2.6. Input Storage¶
The <input_storage>
tag allows you to configure the storage from which
data will be read. You can choose between using the builtin SQLite storage or
implementing your own storage plugin.
Tags within <input_storage> | Description | Multiplicity |
---|---|---|
<sqlite> | Enables converting data from an SQLite database file. See Section 5.2.8. | 0..1 |
<legacy> | Enables converting data from a legacy version of Recording Service to a database usable by this version. See Section 5.2.11. | 0..1 |
<plugin> | Enables converting data from storage using an external library that you specify. See Section 5.2.13. | 0..1 |
<max_samples_per_read> | Specifies the maximum number of samples to be returned by the read() operation. When the recorded tables contain huge amounts of samples, this setting can help improve the responsiveness of Converter, because the tool won’t - for each table - attempt to get all samples at once. If not specified, the default value is 1024 samples. A negative value means an unlimited number of samples. |
0..1 |
5.2.7. Output Storage¶
The <output_storage>
tag allows you to configure the storage into which converted
data will be written. You can choose between using the builtin SQLite storage or
implementing your own storage plugin.
Tags within <output_storage> | Description | Multiplicity |
---|---|---|
<sqlite> | Enables writing converted data into an SQLite database file. See Section 5.2.8. | 0..1 |
<plugin> | Enables writing converted data into storage of your choosing, using a plugin library that you specify. See Section 5.2.13. | 0..1 |
5.2.8. SQLite¶
The <sqlite>
tag allows you to specify the name and file extension of a
SQLite file to read data from, or write data to. Currently, the only storage
format supported for input is CDR, and the only format supported for output is
JSON.
Tags within <sqlite> | Description | Multiplicity |
---|---|---|
<fileset> (output only) | Set of files to write to, and parameters for creating files and directories in that set. Used when creating more than one output file. See Section 5.2.9. | 0..1 |
<file> (output only) | Name of file to write converted database file(s) to. Used when creating only a single output file. Default: rti_recorder_default_converted |
0..1 |
<file_suffix> (output only) | Suffix of the output file. Used when creating only a single output file. Default: dat |
0..1 |
<database_dir> (input only) | Directory containing file(s) to convert. Default: Current working directory. |
0..1 |
<storage_format> | Specifies what format the data is stored in. The options are:
|
0..1 |
<overwrite_policy_kind> | Defines what to do when database files are already present in the current Converter execution directory.
Default: OVERWRITE |
0..1 |
<sql_initialization_string> | Configures a SQL expression to use when establishing SQLite connections using this plugin. You can use this to add an index to a table to speed up replay, but this must be done for each table you want to index.
Default: PRAGMA SYNCHRONOUS = OFF; PRAGMA JOURNAL_MODE = MEMORY; |
0..1 |
5.2.9. Fileset¶
The <fileset>
tag allows you to specify a set of files for Converter to
write to.
The behavior allowed by Converter is more limited than the behavior allowed by Recording Service.
Tags within <fileset> | Description | Multiplicity |
---|---|---|
<workspace_dir> | Required. Default: The current working directory |
1 |
<filename_expression> | Required.
Default: rti_recorder_default_%auto:0%.dat (auto-numeric starting at zero, unlimited) |
1 |
<rollover> | Configuration for rolling over the file after a size limit is reached. See Section 5.2.10. | 0..1 |
5.2.10. Rollover¶
Rollover enables Converter to write to the next file in a set when a limit is reached. Converter’s rollover functionality is decoupled from the files that are input, so many files may be merged into one, or one file may be split into many depending on Converter’s rollover configuration. Currently Converter supports rolling over by size.
Tags within <rollover> | Description | Multiplicity |
---|---|---|
<file_size_limit> | The maximum allowed size for a file in a set. Units can be specified as an attribute.
|
0..1 |
5.2.11. Legacy¶
This tag configures how legacy databases are converted to the newer format. (Note: You can continue to use the older format with Replay, by specifying “legacy” storage in Replay’s configuration.)
Tags within <legacy> | Description | Multiplicity |
---|---|---|
<file_path> | The path to a legacy file to be converted. File set and version properties will be obtained automatically from the file itself. | 0..1 |
<domain_mapping> | This tag allows you to link legacy domain names with domain IDs. See Section 5.2.12. | 0..1 |
5.2.12. Domain Mapping¶
When converting a legacy database, the domain may not have been recorded. This tag provides a way to map a table with a domain ID.
Later versions of the old Recorder database allowed you to use field filters. By default, the domain ID field was not recorded (it was filtered out by default). Thus, there is no information available in these legacy databases to relate the domain name used to record the data with a domain ID. This tag allows you to link legacy domain names with domain IDs.
Tags within <domain_mapping> | Description | Multiplicity |
---|---|---|
<domain_map> | Required.
|
1..* |
5.2.13. Plugin¶
This tag enables you to convert data using an external library that you specify.
Tags within <plugin> | Description | Multiplicity |
---|---|---|
<property> | Name/value pairs of properties to pass to a storage plugin. | 0 or 1 |
5.2.14. Data Selection¶
This tag selects what data to convert from the database, based on a time range.
Tags within <data_selection> | Description | Multiplicity |
---|---|---|
<time_range> | Select data to convert from the database, based on start and end times. See Section 5.2.15. | 0..1 |
5.2.15. Time Range¶
The <time_range>
tag allows you to specify the begin and end times
of the data you want to convert. This can be specified either as timestamps
or as symbolic timestamps called “timestamp tags.” Tags may have been
added to the recording through remote administration, and can be viewed
using the script rtirecordingservice_list_tags
(see Section 3.5.7).
Tags within <time_range> | Description | Multiplicity |
---|---|---|
<begin_time> | Select data to convert from the database, with a timestamp beginning at
this time. Specify the time in seconds and nanoseconds. Default: 0, start at beginning of the file. |
0..1 |
<begin_tag> | Can be used instead of begin_time. Select data to start converting
from the database by specifying the string name of a timestamp tag.
Timestamp tags associate a timestamp with a name. Then you
can refer to a timestamp by that name.
The timestamp must have been tagged with that name during recording.
See Section 3.5.6. Default: Start at beginning of the file. |
0..1 |
<end_time> | Select data to convert from the database, with a timestamp ending at
this time. Specify the time in seconds and nanoseconds. Default: End at end of file. |
0..1 |
<end_tag> | Can be used instead of end_time. Select when to stop converting data
by specifying the string name of a timestamp tag.
Timestamp tags associate a timestamp with a name. Then you
can refer to a timestamp by that name.
The timestamp must have been tagged with that name during recording.
See Section 3.5.6. Default: Stop at end of file. |
0..1 |
5.2.16. DomainParticipant¶
The <domain_participant>
tag allows you to specify the
domain IDs you want to convert from the database. Specify a name for the
DomainParticipant, and the domain_id you want to convert. Associate the
DomainParticipant name with a session, topic or topic_group that you want to
convert, to convert data within a domain.
This does not create a DDS DomainParticipant.
Tags within <domain_participant> | Description | Multiplicity |
---|---|---|
<domain_id> | The domain ID of tables loaded from the database. This is used to determine which domain IDs to convert. | 1 |
<register_type> | Registers a type name and associates it with a type representation.
When you define a type in the configuration file, you have to
register the type in order to use it in a
|
0..* |
5.2.17. Session¶
The <session>
tag configures the threads that will be used to convert
data. You also specify the Topics and groups of Topics to convert inside the
<session> tag.
Tags within <session> | Description | Multiplicity |
---|---|---|
<thread_pool> | Specifies the number of threads used by this session, and the settings used when creating them. | 0..1 |
<topic> | Specifies an individual Topic to convert. See Section 5.2.19.
|
0..* |
<topic_group> | Specifies a group of Topics to convert. See Section 5.2.18.
|
0..* |
5.2.18. Topic Group¶
The <topic_group>
tag allows you to convert a group of Topics,
using regular expressions to describe which Topics to convert.
Tags within <topic_group> | Description | Multiplicity |
---|---|---|
<allow_topic_name_filter> | A regular expression (fnmatch) describing which Topics should be
converted.
You may use a comma-separated list to specify more than one filter.
|
0..1 |
<deny_topic_name_filter> | A regular expression (FNMATCH) describing which Topics should not be
converted. This is applied after the allow_topic_name_filter .
You may use a comma-separated list to specify more than one filter. |
0..1 |
5.2.19. Topic¶
The <topic>
tag specifies an individual Topic to convert.
Tags within <topic> | Description | Multiplicity |
---|---|---|
<topic_name> | The name of the DDS topic to be converted. If this tag is not present,
the name attribute of the <topic> will be used. Note: we recommend using this tag to define the topic name. There may be characters that cause the XML validation to fail if they are part of the topic name attribute. Also, the ‘/’ character and ‘::’ separator may cause Converter to fail when found in the topic name attribute. |
0..1 |
<registered_type_name> | The name of the data type that will be converted for this topic. Required. | 1 |
<transformation> | The transformation library to be applied to this Topic’s data when converting. This is a user library that can modify the data after it is received from input storage and before it is sent to output storage. Transformations implement APIs identical to Routing Service’s transformations. For more on using transformations, see these sections in the RTI Routing Service User’s Manual:
|
0..1 |
5.2.20. Converter’s Builtin Configuration Details¶
Converter comes with a builtin configuration, which selects the name of an input file to convert from and an output file to convert to. The ‘defaultToJson’ configuration specifies JSON SQLite format by default as the output format, with ‘rti_recorder_default.dat’ as the input file and ‘rti_recorder_default_converted.dat’ as the output file. It expects to find the file(s) to convert in a directory called ‘cdr_recording’. This is the default directory when recording in XCDR format in the default Recorder configuration.
<?xml version="1.0" encoding="UTF-8"?>
<dds xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://community.rti.com/schema/6.0.0/rti_converter.xsd">
<!-- Available types -->
<types />
<!-- A definition of a Converter instance to run -->
<converter name="defaultToJson">
<!-- Input storage settings -->
<input_storage>
<sqlite>
<storage_format>XCDR_AUTO</storage_format>
<database_dir>cdr_recording</database_dir>
</sqlite>
</input_storage>
<!-- Output storage settings -->
<output_storage>
<sqlite>
<storage_format>JSON_SQLITE</storage_format>
<fileset>
<workspace_dir>converted</workspace_dir>
<filename_expression>rti_recorder_default.converted.dat</filename_expression>
</fileset>
</sqlite>
</output_storage>
<!-- Domain selection: assume 0 by default -->
<domain_participant name="Domain0">
<domain_id>0</domain_id>
</domain_participant>
</converter>
</dds>