Cyclone ISO C++ API Reference Guide
dds::pub::PublisherListener Class Referenceabstract

Publisher events Listener. More...

#include "PublisherListener.hpp"

Inherits dds::pub::AnyDataWriterListener.

Inherited by dds::domain::DomainParticipantListener [virtual], and dds::pub::NoOpPublisherListener [virtual].

Public Member Functions

virtual void on_liveliness_lost (dds::pub::AnyDataWriter &writer, const ::dds::core::status::LivelinessLostStatus &status)=0
 
virtual void on_offered_deadline_missed (dds::pub::AnyDataWriter &writer, const ::dds::core::status::OfferedDeadlineMissedStatus &status)=0
 
virtual void on_offered_incompatible_qos (dds::pub::AnyDataWriter &writer, const ::dds::core::status::OfferedIncompatibleQosStatus &status)=0
 
virtual void on_publication_matched (dds::pub::AnyDataWriter &writer, const ::dds::core::status::PublicationMatchedStatus &status)=0
 

Detailed Description

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.

All operations for this interface must be implemented in the user-defined class, it is up to the application whether an operation is empty or contains some functionality.

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:
{
std::cout << "on_offered_deadline_missed" << std::endl;
}
{
std::cout << "on_offered_incompatible_qos" << std::endl;
}
virtual void on_liveliness_lost (
{
std::cout << "on_liveliness_lost" << std::endl;
}
virtual void on_publication_matched (
{
std::cout << "on_publication_matched" << std::endl;
}
};
// Create Publisher with the listener
dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id());
dds::pub::Publisher publisher(participant,
participant.default_publisher_qos(),
new ExampleListener(),
See also
Publisher
Listener information

Definition at line 103 of file PublisherListener.hpp.

Member Function Documentation

◆ on_liveliness_lost()

virtual void dds::pub::AnyDataWriterListener::on_liveliness_lost ( dds::pub::AnyDataWriter writer,
const ::dds::core::status::LivelinessLostStatus status 
)
pure virtualinherited

This operation is called by the Data Distribution Service when the LivelinessLostStatus changes.

This operation will only be called when the relevant DataWriterListener is installed and enabled for the liveliness lost status (StatusMask::liveliness_lost()). The liveliness lost status will change when the liveliness that the DataWriter has committed through its LivelinessQosPolicy was not respected. In other words, the DataWriter failed to actively signal its liveliness within the offered liveliness period. As a result, the DataReader objects will consider the DataWriter as no longer “alive”.

Parameters
writercontains a pointer to the DataWriter on which the LivelinessLostStatus has changed (this is an input to the application).
statuscontains the LivelinessLostStatus object (this is an input to the application).

◆ on_offered_deadline_missed()

virtual void dds::pub::AnyDataWriterListener::on_offered_deadline_missed ( dds::pub::AnyDataWriter writer,
const ::dds::core::status::OfferedDeadlineMissedStatus status 
)
pure virtualinherited

This operation is called by the Data Distribution Service when the OfferedDeadlineMissedStatus changes.

This operation will only be called when the relevant DataWriterListener is installed and enabled for the offered deadline missed status (StatusMask::offered_deadline_missed()). The offered deadline missed status will change when the deadline that the DataWriter has committed through its DeadlineQosPolicy was not respected for a specific instance.

Parameters
writercontain a pointer to the DataWriter on which the OfferedDeadlineMissedStatus has changed (this is an input to the application)
statuscontain the OfferedDeadlineMissedStatus object (this is an input to the application).

◆ on_offered_incompatible_qos()

virtual void dds::pub::AnyDataWriterListener::on_offered_incompatible_qos ( dds::pub::AnyDataWriter writer,
const ::dds::core::status::OfferedIncompatibleQosStatus status 
)
pure virtualinherited

This operation called by the Data Distribution Service when the OfferedIncompatibleQosStatus changes.

This operation will only be called when the relevant DataWriterListener is installed and enabled for the StatusMask::offered_incompatible_qos(). The incompatible Qos status will change when a DataReader object has been discovered by the DataWriter with the same Topic and a requested DataReaderQos that was incompatible with the one offered by the DataWriter.

Parameters
writercontain a pointer to the DataWriter on which the OfferedIncompatibleQosStatus has changed (this is an input to the application).
statuscontain the OfferedIncompatibleQosStatus object (this is an input to the application).

◆ on_publication_matched()

virtual void dds::pub::AnyDataWriterListener::on_publication_matched ( dds::pub::AnyDataWriter writer,
const ::dds::core::status::PublicationMatchedStatus status 
)
pure virtualinherited

This operation is called by the Data Distribution Service when a new match has been discovered for the current publication, or when an existing match has ceased to exist.

Usually this means that a new DataReader that matches the Topic and that has compatible Qos as the current DataWriter has either been discovered, or that a previously discovered DataReader has ceased to be matched to the current DataWriter. A DataReader may cease to match when it gets deleted, when it changes its Qos to a value that is incompatible with the current DataWriter or when either the DataWriter or the DataReader has chosen to put its matching counterpart on its ignore-list using the dds::sub::ignore or dds::pub::ignore operations.

it will only be called when the relevant DataWriterListener is installed and enabled for the StatusMask::publication_matched().

Parameters
writercontains a pointer to the DataWriter for which a match has been discovered (this is an input to the application provided by the Data Distribution Service).
statuscontains the PublicationMatchedStatus object (this is an input to the application provided by the Data Distribution Service).

The documentation for this class was generated from the following file:
dds::core::status::OfferedDeadlineMissedStatus
Definition: Status.hpp:195
dds::core::status::LivelinessLostStatus
Definition: Status.hpp:119
dds::pub::AnyDataWriter
Typeless base class for the typed DataWriter.
Definition: AnyDataWriter.hpp:48
dds::pub::Publisher
The Publisher acts on the behalf of one or several DataWriter objects that belong to it.
Definition: Publisher.hpp:55
dds::core::status::StatusMask::all
static StatusMask all()
Definition: State.hpp:195
dds::pub::AnyDataWriterListener::on_liveliness_lost
virtual void on_liveliness_lost(dds::pub::AnyDataWriter &writer, const ::dds::core::status::LivelinessLostStatus &status)=0
dds::core::status::OfferedIncompatibleQosStatus
Definition: Status.hpp:258
dds::pub::AnyDataWriterListener::on_offered_deadline_missed
virtual void on_offered_deadline_missed(dds::pub::AnyDataWriter &writer, const ::dds::core::status::OfferedDeadlineMissedStatus &status)=0
dds::pub::AnyDataWriterListener::on_offered_incompatible_qos
virtual void on_offered_incompatible_qos(dds::pub::AnyDataWriter &writer, const ::dds::core::status::OfferedIncompatibleQosStatus &status)=0
dds::pub::AnyDataWriterListener::on_publication_matched
virtual void on_publication_matched(dds::pub::AnyDataWriter &writer, const ::dds::core::status::PublicationMatchedStatus &status)=0
dds::domain::DomainParticipant::default_publisher_qos
dds::pub::qos::PublisherQos default_publisher_qos() const
dds::core::status::PublicationMatchedStatus
Definition: Status.hpp:356
dds::pub::PublisherListener
Publisher events Listener.
Definition: PublisherListener.hpp:103
dds::domain::DomainParticipant
A DomainParticipant represents the local membership of the application in a Domain.
Definition: DomainParticipant.hpp:65