2. Configuration

This section describes how to configure Routing Service Forwarding Processor.

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

2.1. Load the Forwarding Processor Plugin

Routing Service Forwarding Processor must be registered as a Routing Service plugin by using the <processor_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">
        <processor_plugin name="FwdByValue">
            <dll>rtifwdprocessor</dll>
            <create_function>
                RTI_PRCS_FWD_ByInputValueForwardingEnginePlugin_create
            </create_function>
        </processor_plugin>
        <processor_plugin name="FwdByName">
            <dll>rtifwdprocessor</dll>
            <create_function>
                RTI_PRCS_FWD_ByInputNameForwardingEnginePlugin_create
            </create_function>
        </processor_plugin>
    </plugin_library>
</dds>

Warning

Routing Service must be able to find the Routing Service Forwarding Processor dynamic library (librtifwdprocessor.so on Linux® systems, librtifwdprocessor.dylib on macOS® systems, or rtifwdprocessor.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.

In the snippet above, there are two processors registered, one per functionality of the Routing Service Forwarding Processor.

2.1.1. Configuration Properties

There are some properties in order to configure the Routing Service Forwarding Processor. Depending on the forwarding method used (by name or by value), there is a different set of properties you can configure.

2.1.1.1. Forwarding Processor by Name

The Routing Service Forwarding Processor uses the following properties to configure its behavior when using the forwarding by name method:

Table 2.1 Forwarding by Name Configuration Properties

Property

Required

Values

forwarding_table

YES

A JSON array of entries with format

[
    {
        "input": "INPUT_NAME",
        "output": "OUTPUT_NAME"
    }
]

The input should contain the topic name from where the processor is reading the samples. The output contains the output topic name where the sample will be publish into.

The following snippet shows how to configure this:

<processor plugin_name="MqttShapesPlugins::FwdByName">
    <property>
        <value>
            <element>
                <name>forwarding_table</name>
                <value>
                    [
                        {
                            "input": "Square",
                            "output": "mqtt_squares"
                        },
                        {
                            "input": "Triangle",
                            "output": "mqtt_triangles"
                        },
                        {
                            "input": "Circle",
                            "output": "mqtt_circles"
                        }
                    ]
                </value>
            </element>
        </value>
    </property>
</processor>

2.1.1.2. Forwarding Processor by Value

The Routing Service Forwarding Processor uses the following properties to configure its behavior when using the forwarding by value method:

Table 2.2 Forwarding by Value Configuration Properties

Property

Required

Values

forwarding_table

YES

A JSON array of entries with format

[
    {
        "input": "INPUT_NAME",
        "output": "OUTPUT_NAME"
    }
]

input_members

YES

A JSON array of entries with format

[
    {
        "input": "INPUT_NAME",
        "member": "INPUT_MEMBER"
    }
]

In the property input_members, the input should contain the value of the field specified in member that will be forwarded. On the other hard, the forwarding_table shall contain the input and output where the sample will be forwarded from and to.

The input may contain wildcards as this exapmle shows:

The following snippet shows how to configure this:

<processor plugin_name="MqttShapesPlugins::FwdByValue">
    <property>
        <value>
            <element>
                <name>input_members</name>
                <value>
                    [
                        {
                            "input": "*",
                            "member": "topic"
                        }
                    ]
                </value>
            </element>
            <element>
                <name>forwarding_table</name>
                <value>
                    [
                        {
                            "input": "*/squares",
                            "output": "Square"
                        },
                        {
                            "input": "*/triangles",
                            "output": "Triangle"
                        },
                        {
                            "input": "*/circles",
                            "output": "Circle"
                        }
                    ]
                </value>
            </element>
        </value>
    </property>
</processor>