historical data for late joining subscribers

2 posts / 0 new
Last post
Offline
Last seen: 13 years 5 months ago
Joined: 06/19/2011
Posts: 1
historical data for late joining subscribers

Hi,

 

I want to receive historical data that is published by a publisher application before the subcriber application started. I set the Qos as TransientLocal, Reliable and KeepAllHistory in the Qos.xml file. In datareader  I wait for 1 second to receive data by using wait_for_historical_data() method and then try receiving data by using take() method, but I can not receive any data. In the next step, I create a datalistener and the listener can take the historical data but due to the asynchronous call of on_data_available() method, the it takes much time to get the historical data.

 

How can I receive the historical data in datareader without waiting the asynchronous call of data listener's method? Is there any other configuration that I need to do in the Qos.xml file? Could anyone help?

 

Kind regards,

Emre

Shaun's picture
Offline
Last seen: 13 years 5 months ago
Joined: 08/14/2010
Posts: 2

 

The max_wait parameter to the wait_for_historical_data() call is a timeout value.  This is explained in our API documentation.  Depending on how much data you write, setting a 1 second timeout may not be enough for the late-joining reader to receive all the historical samples.  Keep in mind that since you have strictly reliable communication, the middleware will not stop until all the historically stored samples are confirmed to be delivered to the reader.  What I’m suggesting is there may be additional time/traffic needed to repair samples lost in transit.  You should check the return value of the call to determine if all historical samples were received (return value OK) or if the return value is “TIMEOUT”.

 

To insure that your receive thread for messages on your reader is be serviced as efficiently as possible, you will probably want to do as little processing in your on_data_available callback as possible to insure that it returns as quickly as possible to receive another message.