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 DDS 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 INCONSISTENT_TOPIC Status.

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

If a Topic’s Listener has not been set and Connext DDS detects an inconsistent Topic, the DomainParticipantListener (if it exists) will be notified instead (see 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.

© 2018 RTI