You are here: Part 3: Advanced Concepts > Configuring QoS with XML > QoS Profiles > Topic Filters

Topic Filters

A QoS profile may contain several writer, reader and topic QoSs. Connext DDS will select a QoS based on the evaluation of a filter expression on the topic name. The filter expression is specified as an attribute in the XML QoS definition. For example:

<qos_profile name="StrictReliableCommunicationProfile">
<datawriter_qos topic_filter="A*">
		<history>
			<kind>KEEP_ALL_HISTORY_QOS</kind>
		</history>
		<reliability>
			<kind>RELIABLE_RELIABILITY_QOS</kind>
		</reliability>
	</datawriter_qos>
<datawriter_qos topic_filter="B*">
		<history>
			<kind>KEEP_ALL_HISTORY_QOS</kind>
		</history>
		<reliability>
			<kind>RELIABLE_RELIABILITY_QOS</kind>
		</reliability>
		<resource_limits>
			<max_samples>128</max_samples>
			<max_samples_per_instance>128
			</max_samples_per_instance>
			<initial_samples>128</initial_samples>
			<max_instances>1</max_instances>
			<initial_instances>1</initial_instances> 
		</resource_limits>
	</datawriter_qos>
	...
</qos_profile>

If topic_filter is not specified in a QoS, Connext DDS will assume the filter '*'. The QoSs with an explicit topic_filter attribute definition will be evaluated in order; they have precedence over a QoS without a topic_filter expression.

The topic_filter attribute is only used with the following APIs:

DomainParticipantFactory:

DomainParticipant:

Publisher:

Subscriber:

Topic:

DataWriter:

DataReader:

Other APIs will ignore QoSs with a topic_filter value different than "*". A QoS Profile with QoSs using topic_filter can also inherits from other QoS Profiles. In this case, inheritance will consider the value of the topic_filter expression.

© 2015 RTI