SubscribersΒΆ
A Subscriber is a consumer of data on a Domain. It uses the DomainParticipants to gain access to the Domain and is created using it. A Subscriber allows the DataReaders associated with it to share the same behaviour, such as:
Liveliness notifications
Listeners callbacks
To use the default settings:
dds_entity_t subscriber = dds_create_subscriber (participant, NULL, NULL);
dds::sub::Subscriber sub(participant);
subscriber = Subscriber(participant)
To supply your own settings:
dds_qos_t *qos = dds_create_qos ();
dds_listener_t *listener = dds_create_listener(NULL);
dds_lset_subscription_matched(listener, subscription_matched);
dds_entity_t subscriber = dds_create_subscriber (participant, qos, listener);
dds::sub::NoOpSubscriberListener 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_subscription_matched virtual function as we will rely on it later*/
dds::sub::qos::SubscriberQos subqos; /*add custom QoS policies that you want for this subscriber*/
dds::sub::Subscriber sub(participant, subqos, &listener, dds::core::status::StatusMask::subscription_matched());
Python code sample TBD
Note
Any DataReaders created using sub
inherit the qos and listener functionality as set through it.