3.5.5. 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()

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