Best way to poll for latest sample of an instance?

3 posts / 0 new
Last post
Last seen: 5 years 2 months ago
Joined: 10/01/2015
Posts: 17
Best way to poll for latest sample of an instance?

What is the best method to poll a reader for the latest sample of a given instance?

I can think of a several ways to do it, but I'm not sure which is 'best':

1) Call plain read, manually compare key fields for each sample, starting from the end of the sequence.

2) Call read_w_condition with a query condition that compares the key fields.  Is this any different than 1?

3) Call read_instance.  This requires additional logic to lookup_instance on each poll iteration untill lookup_instance returns non-nil.  The polling will occur before publisher have come online.


1) No content filter is used, this reader is used to read for more than this one instance.

2) It should return the most recent valid_data sample from the reader's cache, even if the instance has since become not-alive.

3) Reader history depth is set to KeepLast(1).  I only ever care about the latest value for this application.

4) I don't need low-latency or to react to every published sample.  The additional complexity of listeners or waitsets is not required.



Last seen: 4 years 12 months ago
Joined: 12/07/2016
Posts: 10

@seymour33: Have you gotten this question resolved? I'm also looking fo a solution to the same question.

Last seen: 6 years 7 months ago
Joined: 09/17/2015
Posts: 53


Iterate with this: