2. Configuration

This section describes how to configure Routing Service Field Trasformation.

All configuration is specified in Routing Service’s XML configuration file.

2.1. Load the Field Transformation Plugin

Routing Service Field Trasformation must be registered as a Routing Service plugin by using the <transformation_plugin> tag.

The following snippet demonstrates how to register the plugin in the <plugin_library> section of Routing Service’s XML configuration:

<?xml version="1.0"?>
<dds>
    <plugin_library name="MyPlugins">
        <transformation_plugin name="PrimitiveField">
        <dll>rtifieldtransf</dll>
        <create_function>
            RTI_TSFM_Field_PrimitiveTransformationPlugin_create
        </create_function>
    </transformation_plugin>
    </plugin_library>
</dds>

Warning

Routing Service must be able to find the Routing Service Field Trasformation dynamic library (librtifieldtransf.so on Linux® systems, librtifieldtransf.dylib on macOS® systems, or rtifieldtransf.dll on Windows® systems). Make sure to include the library’s directory in the library search path environment variable appropriate for your system (LD_LIBRARY_PATH on Linux systems, RTI_LD_LIBRARY_PATH on macOS systems, or PATH on Windows systems, etc.).

Once the dynamic library and constructor function have been registered, Routing Service will create an instance of the plugin during start-up.

2.1.1. Configuration Properties

The Routing Service Field Trasformation uses the following variables to configure its behavior:

Table 2.1 Field Transformation Configuration Properties

Property

Required

Default

Accepted Values

buffer_member

YES

-

An identifier for a member of a type (e.g. ‘foo.bar’)

field

YES

-

An identifier for a field of a type (e.g. ‘foo.bar’)

field_type

YES

-

An IDL primitive type (e.g. ‘unsigned long’, ‘uint64’)

max_serialized_size

NO

255

An integer value greater or equal to 0

serialization_format

NO

Depends on field_type

A format string accepted by sprintf()

The following snippet shows how to configure these properties:

<transformation plugin_name="MyPlugins::PrimitiveField">
    <property>
        <value>
            <element>
                <name>buffer_member</name>
                <value>payload.data</value>
            </element>
            <element>
                <name>field</name>
                <value>x</value>
            </element>
            <element>
                <name>field_type</name>
                <value>long</value>
            </element>
        </value>
    </property>
</transformation>