31.4 Setting Up DataWriterListeners

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

Note: Some operations cannot be used within a listener callback, see 15.8.8.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 30.5 Setting Up PublisherListeners and 16.3.6 Setting Up DomainParticipantListeners).

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

Table 31.2 DataWriterListener Callbacks

This DataWriterListener callback...

... is triggered by ...

on_instance_replaced()

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

on_liveliness_lost

A change to 31.6.4 LIVELINESS_LOST Status

on_offered_deadline_missed

A change to 31.6.5 OFFERED_DEADLINE_MISSED Status

on_offered_incompatible_qos

A change to 31.6.6 OFFERED_INCOMPATIBLE_QOS Status

on_publication_matched

A change to 31.6.7 PUBLICATION_MATCHED Status

on_reliable_writer_cache_changed

A change to 31.6.8 RELIABLE_WRITER_CACHE_CHANGED Status (DDS Extension)

on_reliable_reader_activity_changed

A change to 31.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 Chapter 34 Sending Large Data)

on_application_acknowledgment

Application acknowledgment (see 31.6.1 APPLICATION_ACKNOWLEDGMENT_STATUS)

on_service_request_accepted

A change to 31.6.10 SERVICE_REQUEST_ACCEPTED Status (DDS Extension).