PublishersΒΆ
A Publisher is a producer of data on a Domain. It uses the DomainParticipants to gain access to the Domain and is created using it. That is, the Publisher passes down the Domain from its parent class DomainParticipant. A Publisher allows the DataWriters associated with it to share the same behaviour, for example:
Liveliness notifications
Listeners callbacks
To use the default settings:
dds_entity_t publisher = dds_create_publisher (participant, NULL, NULL);
dds::pub::Publisher pub(participant);
publisher = Publisher(participant)
To supply your own settings:
dds_qos_t *qos = dds_create_qos ();
dds_listener_t *listener = dds_create_listener(NULL);
dds_lset_publication_matched(listener, publication_matched);
dds_entity_t publisher = dds_create_spublisher (participant, qos, listener);
dds::pub::NoOpPublisherListener listener; /*you need to create your own class that derives from this listener, and implement your own callbacks*/
/*the listener implementation should implement the on_publication_matched virtual function as we will rely on it later*/
dds::pub::qos::PublisherQos pubqos; /*add custom QoS policies that you want for this publisher*/
dds::pub::Publisher pub(participant, pubqos, &listener, dds::core::status::StatusMask::publication_matched()); /*in this case, the only status we are interested in is publication_matched*/
Python code sample TBD
Note
Any DataWriters created using pub
inherit the qos and listener functionality as set through it.