Instance handle

1 post / 0 new
Last seen: 6 years 4 months ago
Joined: 04/28/2013
Posts: 38
Instance handle


I'm trying to add correct handling for instance change from NOT_ALIVE_NO_WRITERS to ALIVE in the reader, so I could pass the samples for the 'reborn' instance to the application. I've done so by reading from the datareader with mask SampleStateKind.READ_SAMPLE_STATE and InstanceStateKind.NOT_ALIVE_NO_WRITERS_INSTANCE_STATE.

To avoid duplication of data, i'm also comparing sampleInfo.publication_handle with the LivelinessChangedStatus.last_publication_handle from the argument I receive in on_liveliness_changed callback.

I'd like to have a better understanding of what publication_handle is comprised of (what are the 16 bytes in InstanceHandle_t). Am I right in assuming that the instance_id is bytes 8-11? If so, is it enough to compare those? Does the instance_id uniquely identify the instance or should I also check something else?

I'd also like to know what should be done if the original writer is that of a persistence service working in synchronization with another persistence service.

An example for such a scenario:

The datawriter of PRST1 sends the original samples to the datareader, both PRST1 and PRST2 are shut down, reader receives NOT_ALIVE_NO_WRITERS, only PRST2 is up again (not the original publisher)