Hello,
how can I dispose an instance in the presence of KEEP_ALL_HISTORY_QOS? When I write to a keyed topic with KEEP_ALL multiple times on an instance and then start the reader I get all written data. Good so far. When I then call 'dispose' on that instance the reader sees all data and then a DDS_NOT_ALIVE_DISPOSED_INSTANCE_STATE. I assumed the writer would remove all data with the instance from the queue which it obviously does not. How can I 'clear' the writer queue if not with dispose()? Everything works as expected with KEEP_LAST_HISTORY_QOS, depth 1.
See following output:
Write to topic KEEP_LAST_HISTORY_QOS, 1:
0002: Written 14.8 m/s
Reader:
0002: Got 14.8 m/s
Dispose topic KEEP_LAST_HISTORY_QOS, 1:
0002: Disposed sample
Reader:
-No data-
Write to topic KEEP_ALL_HISTORY_QOS:
0003: Written 17.1 m/s
0003: Written 13.6 m/s
0003: Written 18.0 m/s
0003: Written 11.8 m/s
0003: Written 8.6 m/s
Reader:
0003: Got 17.1 m/s
0003: Got 13.6 m/s
0003: Got 18.0 m/s
0003: Got 11.8 m/s
0003: Got 8.6 m/s
Write topic KEEP_ALL_HISTORY_QOS:
0003: Disposed sample
Reader:
0003: Got 17.1 m/s
0003: Got 13.6 m/s
0003: Got 18.0 m/s
0003: Got 11.8 m/s
0003: Got 8.6 m/s
0003: Dead 0.0 m/s
I could not find in the manual if this is a documented feature.
Thank you for your help.
Regards
Josef
Found the solution:
The following QoS in the XML file purges the DataWriter queue immediately
<writer_data_lifecycle>
<autopurge_unregistered_instances_delay>
<sec>DURATION_ZERO_SEC</sec>
<nanosec>DURATION_ZERO_NSEC</nanosec>
</autopurge_unregistered_instances_delay>
</writer_data_lifecycle>
The dispose() still stays in the queue (which might be helpful) but the unregister_instance() really removes the samples from the writer.
Regards
Josef