3.5.3. TopicListenerΒΆ

TopicListener is an abstract class defining the callbacks that will be triggered in response to state changes on the Topic. By default, all these callbacks are empty and do nothing. The user should implement a specialization of this class overriding the callbacks that are needed on the application. Callbacks that are not overridden will maintain their empty implementation.

TopicListener has the following callback:

  • on_inconsistent_topic(): A remote Topic is discovered with the same name but different characteristics as another locally created Topic.


Currently on_inconsistent_topic() is not implemented (it will never be called), and will be implemented on a future release of Fast DDS.

class CustomTopicListener : public TopicListener


    : TopicListener()

    virtual ~CustomTopicListener()

    virtual void on_inconsistent_topic(
            Topic* topic,
            InconsistentTopicStatus status)
        (void)topic, (void)status;
        std::cout << "Inconsistent topic received discovered" << std::endl;