18.1.5 Setting Up TopicListeners

When you create a Topic, you have the option of giving it a Listener. A TopicListener includes just one callback routine, on_inconsistent_topic(). If you create a TopicListener (either as part of the Topic creation call, or later with the set_listener() operation), Connext will invoke the TopicListener’s on_inconsistent_topic() method whenever it detects that another application has created a Topic with same name but associated with a different user data type. For more information, see 18.2.1 INCONSISTENT_TOPIC Status.

Note: Some operations cannot be used within a listener callback, see 15.8.8.1 Restricted Operations in Listener Callbacks.

If a Topic’s Listener has not been set and Connext detects an inconsistent Topic, the DomainParticipantListener (if it exists) will be notified instead (see 16.3.6 Setting Up DomainParticipantListeners). So you only need to set up a TopicListener if you need to perform specific actions when there is an error on that particular Topic. In most cases, you can set the TopicListener to NULL and process inconsistent-topic errors in the DomainParticipantListener instead.