Identify data samples

2 posts / 0 new
Last post
Last seen: 7 years 1 month ago
Joined: 01/09/2013
Posts: 11
Identify data samples

After reading about DDS Instances and data samples I have the following question:

On a DDS instance you have the possibility of setting a key much like a keys in relational databases.

How do you uniquely identify data samples from each other?

I can see that the DataWriter class has a "write_w_timestamp" function - is that the way to uniquely identify data samples from each other?



Gerardo Pardo's picture
Last seen: 3 weeks 4 days ago
Joined: 06/02/2010
Posts: 592


Individual Samples are uniquely identified by the so called SampleIdentity. This is a pair that consists of a 16-Byte Virtual GUID and a 64-bit sequence number.

The 16-Byte Virtual GUID is logically the Global Unique IDentifier (GUID) of the DataWriter that write the sample. It is "Virtual" because the sample may be relayed by intermediate services, like the Persistence Service or the Routing Service. In this case the GUID of the DataWriter that physically writes the sample is different from the GUID of the original DataWriter. So both are communicated along with the sample so the unique identity can be preserved.

The SampleIdentity is available as part of the DDS_SampleInfo received with each sample. It is the pair formed by the fields: original_publication_virtual_guid and original_publication_virtual_sequence_number.

The SampleIdentity is automatically set for you when you write the sample. However there is a way to set it explicilty by an application using the DataWriter::write_w_params operation.  It is a public API but really an advanced API/use-case and normally used only by our infrastructure services, things like our Persistence Service and our Routing Service.

Unfortunately these concepts are still not very well explained in the RTI Connext DDS User's Manual. But you can find some information in Table 6.15 on the row where it explains the field called identity.

Not sure if this is what you were looking for...  Can you provide some more details on what you are trying to do with this unique identity? That way we may be able to provide a better answer...