Expired Lifespan Callback

2 posts / 0 new
Last post
Last seen: 2 years 6 months ago
Joined: 10/27/2021
Posts: 9
Expired Lifespan Callback

Hi Community,


For a project we are designing a progam that ask subscribers if they can do a certain activity. Therefore we have a 'Request' and 'Response' topic.

The subscribers only respond to the request when they can do the requested activity. So when 0 subscribers can do the activity, there will be no response in the 'Response' topic.


I've implemented the lifespan QoS so that requests automatically disappear. We don't want the subscribers responding to an old request. 

But now the request program doesn't know when a sample is 'deleted'/disposed. Is there a way to get a callback/event from a disposed sample or instance?

I've found a previous question, but that one doesn't have an answer (https://community.rti.com/forum-topic/determining-lifespan-expired-samples-writer-side).


The program is written in C# with .NET/dotnet Framework version 4.6.1.


Thanks in advance!


Howard's picture
Last seen: 9 hours 42 min ago
Joined: 11/29/2012
Posts: 582

To be clear, you're asking if the DataWriter sending the request can be notified when the request is deleted and removed from the DataWriter's send queue and/or the DataReader's receive queue?  If so, then unfortunately, no.

A few concepts to clarify:

  • A data sample can be "removed" from the DataWriter or DataReader's queue under many different circumstances.
  • "Dispose" is a formal concept in DDS.  It works with "instances" of a datatype...and so if the datatype of the topic is not keyed, DataWriter::dispose() may not do what you thik it does
  • Removing a sample due to an expired lifespan does NOT "dispose" an instance.  It is not the same operation as calling DataWriter::dispose() on an instance

I also note that the only way that a DataReader would receive an "old" request, where "old" means that the request was sent before the DataWriter discovered (was connected) to the DataReader (perhaps because the DataReader was created after the DataWriter) is if you have configured the Durability QosPolicy to be non-VOLATILE.  Otherwise, DataWriters do not send previously send data to newly discovered DataReaders.