7.3.4 Setting Up DataWriterListeners

DataWriters may optionally have Listeners. Listeners are essentially callback routines and provide the means for Connext DDS to notify your application of the occurrence of events (status changes) relevant to the DataWriter. For more general information on Listeners, see 4.4 Listeners.

Note: Some operations cannot be used within a listener callback, see 4.5.1 Restricted Operations in Listener Callbacks.

If you do not implement a DataWriterListener, the associated PublisherListener is used instead. If that Publisher also does not have a Listener, then the DomainParticipant’s Listener is used if one exists (see 7.2.5 Setting Up PublisherListeners and 9.3.6 Setting Up DomainParticipantListeners).

Listeners are typically set up when the DataWriter is created (see 7.2 Publishers). You can also set one up after creation by using the set_listener() operation. Connext DDS will invoke a DataWriter’s Listener to report the status changes listed in Table 7.4 DataWriterListener Callbacks (if the Listener is set up to handle the particular status, see 7.3.4 Setting Up DataWriterListeners).

Table 7.4 DataWriterListener Callbacks

This DataWriterListener callback...

... is triggered by ...

on_instance_replaced()

A replacement of an existing instance by a new instance; see 7.5.22.2 Configuring DataWriter Instance Replacement

on_liveliness_lost

A change to 7.3.6.4 LIVELINESS_LOST Status

on_offered_deadline_missed

A change to 7.3.6.5 OFFERED_DEADLINE_MISSED Status

on_offered_incompatible_qos

A change to 7.3.6.6 OFFERED_INCOMPATIBLE_QOS Status

on_publication_matched

A change to 7.3.6.7 PUBLICATION_MATCHED Status

on_reliable_writer_cache_changed

A change to 7.3.6.8 RELIABLE_WRITER_CACHE_CHANGED Status (DDS Extension)

on_reliable_reader_activity_changed

A change to 7.3.6.9 RELIABLE_READER_ACTIVITY_CHANGED Status (DDS Extension)

on_sample_removed

Removal of a sample from the DataWriter queue, when the sample was written with a cookie using the write_w_params API or if the DataWriter supports loaned samples, which are used by Zero Copy over shared memory and FlatData language binding (see 23. Sending Large Data)

on_application_acknowledgment

Application acknowledgment (see 7.3.6.1 APPLICATION_ACKNOWLEDGMENT_STATUS)

on_service_request_accepted

A change to 7.3.6.10 SERVICE_REQUEST_ACCEPTED Status (DDS Extension).

© 2020 RTI