9. Topic Query Support¶
Routing Service is fully compatible with TopicQueries (see Topic Queries in the RTI Connext DDS Core Libraries User’s Manual). You can enable this functionality in TopicRoutes and AutoTopicRoutes with two different query modes:
- Dispatch mode: The TopicRoute’s DataWriter configured with TRANSIENT_LOCAL durability will accept matching TopicQueries and dispatch them from its own sample cache.
- Propagation mode: TopicQueries are propagated from the user DataReaders to the user DataWriters. These DataWriters will be the final endpoints that dispatch the propagated TopicQueries.
Routing Service allows propagating TopicQueries from DataReaders to DataWriters acting as a proxy of TopicQueries. Routing Service supports TopicQuery proxy in either of the above modes. It is not possible to enable both modes within the same TopicRoute. However, you can create multiple TopicRoutes/AutoTopicRoutes with different TopicQuery proxy modes.
You can enable a TopicQuery proxy with the <topic_query_proxy>
tag available
under the TopicRoute configuration (see Section 4.5.6) and AutoTopicRoute
configuration (see Section 4.5.8).
The following sections describe the Routing Service proxy modes. Figure 9.1 summarizes the symbols you will see in the figures that illustrate the modes’ behaviors.
![Symbol Legend for Proxy Modes Figures](_images/RouterTopicQueryLegend.png)
Figure 9.1 Symbol Legend for Proxy Modes Figures
9.1. Dispatch Mode¶
Dispatch mode refers to enabling TopicQuery dispatch in a TRANSIENT_LOCAL TopicRoute’s DataWriter. This is done by configuring its TopicQueryDispatchQosPolicy. It no different than enabling a TopicQuery for a DataWriter in a user application.
Figure 9.2 shows a simple scenario. A TopicQuery (TQn) issued by a user DataReader (DRn) will be received by the TopicRoute’s StreamWriter. The StreamWriter will process the TopicQuery and dispatch it, providing the corresponding samples from the available history in the StreamWriter. As a result, the user DataReader will receive live samples (SLive) and TopicQuery samples (STQ).
![|TR| Enabling |TQ| Proxy in Dispatch Mode](_images/RouterTopicQueryDispatch.png)
Figure 9.2 TopicRoute Enabling TopicQuery Proxy in Dispatch Mode
Dispatch mode can be useful when the user DataWriter on the publication side is part of an application with low-resources requirements, such as low power consumption and small memory capacity. In this case, a Routing Service instance connected to the application can cache a set of data published by the user DataWriter and dispatch the TopicQueries issued by user DataReaders.
To enable TopicQuery proxy dispatch mode, use the following configuration tags within a TopicRoute/AutoTopicRoute configuration:
<topic_query_proxy>
<mode>DISPATCH</mode>
</topic_query_proxy>
The above configuration will cause the Durability QoS setting for the TopicRoute’s output DataWriter to be TRANSIENT_LOCAL and will enable TopicQuery dispatch. If you want to configure advanced dispatch features, you can set other options in the TopicQueryDispatchQosPolicy within the corresponding DataWriter QoS tag.
9.2. Propagation Mode¶
Propagation mode refers to having Routing Service act as a proxy of TopicQueries. The TopicRoutes propagate the TopicQueries issued by the matching user DataReaders to the matching user DataWriters. Then the samples generated for both the TopicQuery and live stream are ‘propagated’ to the original user DataReaders. Figure 9.3 shows a simple scenario.
![|TR| Enabling |TQ| Proxy in Dispatch Mode](_images/RouterTopicQueryPropagation.png)
Figure 9.3 TopicRoute Enabling TopicQuery Proxy in Propagation Mode
The TopicRoute propagates the TopicQuery requests from user DataReaders on the subscription side to the user DataWriters on the publication side. User DataWriters eventually dispatch the TopicQuery requests and generate samples for the TopicQuery stream. The samples for a specific TopicQuery are routed to the corresponding original user DataReader that issued such TopicQuery.
For a given TopicRoute, the propagation of TopicQuery requests and samples for both the TopicQuery and live stream occurs sequentially. The expected traffic pattern consists of TopicQuery requests, TopicQuery samples, and live samples interleaved.
TopicQuery propagation is also compatible with filter propagation (see Section 8). You can enable both at the same time and expect live samples to be filtered accordingly, and TopicQuery samples to be unaffected by the filters.
To enable TopicQuery proxy dispatch mode, you can use the following configuration tags within a TopicRoute/AutoTopicRoute configuration:
<topic_query_proxy>
<mode>PROPAGATION</mode>
</topic_query_proxy>
Note that the above configuration will cause the TopicRoute’s output DataWriter durability QoS setting to be VOLATILE.
9.3. Restrictions¶
TopicQuery proxy in PROPAGATION mode cannot be enabled when:
- Using Routes or AutoRoutes, since they are meant to work with other adapters different than the builtin DDS one.
- A transformation is present in the TopicRoute’s output.
- The TopicRoute has a custom processor.