Cannot detect when an instance is deleted

3 posts / 0 new
Last post
Offline
Joined: 01/09/2019
Posts: 2
Cannot detect when an instance is deleted

I'm trying to determine (on a Subscriber) when an instance is deleted (from a Publisher).  Using the code generator with example I am able to test and show this working, however, when I move that code to my main application it doesn't perform the same way.

In generated example code, I added a simple MyObjectTypeSupport.delete_data(instance) call after looping through a few write() calls. 

On the Subscriber I have:

for (int i = 0; i < data_length; ++i) {
    if (info_seq.get_at(i).instance_state ==   DDS.InstanceStateKind.NOT_ALIVE_DISPOSED_INSTANCE_STATE) {  
        // We get here showing the instance is deleted

The same code is not working in production.  I can verify that the delete call is being made in the debugger for an instance.  I have verified receipt of the alive instances on the Subscriber(s), however they never enter into the NOT_ALIVE_DISPOSED_INSTANCE_STATE check and simply stop receiving updates after the instance is deleted.

Using the Admin Console, I subscribed to an XML conversion of my IDL and can see the individual instances as ALIVE.  When the instances are deleted, there is no change in the admin console.  If I manually unsubscribe from the topic and subscribe again, the instance list now does not contain the deleted instances.

The delete appears to be working, but I am not getting a final instance_state indicating this in my subscribers or the admin console.

Offline
Joined: 02/11/2016
Posts: 142

Hello,

I believe the delete_data operation only helps you clean resources locally.

You should use dispose (http://community.rti.com/rti-doc/500/ndds/doc/html/api_cpp/structFooDataWriter.html#a742a2c7fa2b6535df9d89fb8d1ae1009) to trigger NOT_ALIVE_DISPOSED_INSTANCE_STATE (I believe some qos can trigger NOT_ALIVE_DISPOSED_INSTANCE_STATE without you calling dispose but in your example I believe you'll need to do this).

 

Good luck,

Roy.

Offline
Joined: 01/09/2019
Posts: 2

That was the proper call.  Thank you.