34.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 18.8 Listeners.
Note: Some operations cannot be used within a listener callback, see 18.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 33.5 Setting Up PublisherListeners and 19.3.6 Setting Up DomainParticipantListeners).
Listeners are typically set up when the DataWriter is created (see Chapter 33 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 34.2 DataWriterListener Callbacks (if the Listener is set up to handle the particular status, see 34.4 Setting Up DataWriterListeners).
|
This DataWriterListener callback... |
... is triggered by ... |
|
A replacement of an existing instance by a new instance; see 59.6.1 Configuring DataWriter Instance Replacement |
|
|
A change to 34.6.4 LIVELINESS_LOST Status |
|
|
A change to 34.6.5 OFFERED_DEADLINE_MISSED Status |
|
|
A change to 34.6.6 OFFERED_INCOMPATIBLE_QOS Status |
|
|
A change to 34.6.7 PUBLICATION_MATCHED Status |
|
|
A change to 34.6.8 RELIABLE_WRITER_CACHE_CHANGED Status (DDS Extension) |
|
|
A change to 34.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 37 Sending Large Data) |
|
on_application_acknowledgment |
Application acknowledgment (see 34.6.1 APPLICATION_ACKNOWLEDGMENT_STATUS) |
|
A change to 34.6.10 SERVICE_REQUEST_ACCEPTED Status (DDS Extension). |