Class PublisherListener
Defined in File PublisherListener.hpp
Inheritance Relationships
Base Type
public eprosima::fastdds::dds::PublisherListener
(Class PublisherListener)
Derived Type
public dds::pub::NoOpPublisherListener
(Class NoOpPublisherListener)
Class Documentation
-
class PublisherListener : public eprosima::fastdds::dds::PublisherListener
Publisher events Listener.
Since a Publisher is an Entity, it has the ability to have a Listener associated with it. In this case, the associated Listener should be of type PublisherListener. This interface must be implemented by the application. A user-defined class must be provided by the application which must extend from the PublisherListener class.
The PublisherListener provides a generic mechanism (actually a callback function) for the Data Distribution Service to notify the application of relevant asynchronous status change events, such as a missed deadline, violation of a QosPolicy setting, etc. The PublisherListener is related to changes in communication status StatusConditions.
// Application example listener class ExampleListener : public virtual dds::pub::PublisherListener { public: virtual void on_offered_deadline_missed ( dds::pub::AnyDataWriter& writer, const dds::core::status::OfferedDeadlineMissedStatus& status) { std::cout << "on_offered_deadline_missed" << std::endl; } virtual void on_offered_incompatible_qos ( dds::pub::AnyDataWriter& writer, const dds::core::status::OfferedIncompatibleQosStatus& status) { std::cout << "on_offered_incompatible_qos" << std::endl; } virtual void on_liveliness_lost ( dds::pub::AnyDataWriter& writer, const dds::core::status::LivelinessLostStatus& status) { std::cout << "on_liveliness_lost" << std::endl; } virtual void on_publication_matched ( dds::pub::AnyDataWriter& writer, const dds::core::status::PublicationMatchedStatus& status) { std::cout << "on_publication_matched" << std::endl; } }; // Create Publisher with the listener dds::domain::DomainParticipant participant(org::opensplice::domain::default_id()); dds::pub::Publisher publisher(participant, participant.default_publisher_qos(), new ExampleListener(), dds::core::status::StatusMask::all());
See also
Publisher
See also
Listener information
Subclassed by dds::pub::NoOpPublisherListener