The TOPIC_QUERY_DISPATCH QosPolicy configures the ability of a DataWriter to publish historical samples in response to a TopicQuery (see Topic Queries).

It contains the members listed in DDS_TopicQueryDispatchQosPolicy.



Field Name




Allows this writer to dispatch TopicQueries.

struct DDS_Duration_t


Sets the periodic interval at which samples are published.



Sets the maximum number of samples to publish in each publication_period

This QoS policy configures the ability of a DataWriter to publish samples in response to a TopicQuery.

It enables the ability of a DataWriter to publish historical samples upon reception of a TopicQuery and how often they are published.

Since a TopicQuery selects previously written samples, the DataWriter must have a DurabilityQosPolicy kind different from DDS_VOLATILE_DURABILITY_QOS. Also, the ReliabilityQosPolicy kind must be set to DDS_RELIABLE_RELIABILITY_QOS.

A TopicQuery may select multiple samples at once. The writer will publish them periodically, independently from newly written samples. TopicQueryDispatchQosPolicy's publication_period configures the frequency of that period and its samples_per_period configures the maximum number of samples to publish each period.

If the DataWriter blocks during the publication of one of these samples, it will stop and try again the next period. (See Writing Data (FooDataWriter::write()) for the conditions that may cause the write operation to block.)

All the DataWriters that belong to a single Publisher and enable TopicQueries share the same event thread, but each DataWriter schedules separate events. To configure that thread, see the AsynchronousPublisherQosPolicy's topic_query_publication_thread.

If the DataWriter is dispatching more than one TopicQuery at the same time, the configuration of this periodic event applies to all of them. For example, if a DataWriter receives two TopicQueries around the same time, the period is 1 second, the number of samples per period is 10, the first TopicQuery selects five samples, and the second one selects 8, the DataWriter will immediately attempt to publish all five for the first TopicQuery and five for the second one. After one second, it will publish the remaining three samples.


This QosPolicy cannot be modified after the Entity is enabled.

There are no requirements that the publishing and subscribing sides use compatible values.

Related QosPolicies


Applicable Entities

System Resource Considerations


© 2018 RTI