I have set up an application which subscribes to a topic and prints all recieved messages every few seconds. The problem is that when it wakes up and goes to call the waitset.wait method which correctly returns a data_available_status it calls the reader.take method and only ends up with a sequence length of 1 however between sleeps it should have received multiple messages on that topic. I need to configure it so that I get all received messages on that topic not just what appears to be the most recent one.
I looked at a few examples including the hello world ones and they seem to exhibit the same behavior.
I have attached a example of how its setup.
Attachment | Size |
---|---|
examplecode.txt | 1.7 KB |
My guess is that the reader's history.kind is KEEP_ALL and the history.depth is 1.
Where does the application get its QoS from: in code, built-in profiles or USER_QOS_PROFILES.xml?
currently getting it from USER_QOS_PROFILES.xml but there are no QoS properties set in it for the readers.
You should read up on how/where QoS comes from, if you don't set it.
DataReaderQos drqos = new DataReaderQos();
reader.get_qos(drqos);
System.out.println("History: " + drqos.history.toString());
returns
History: HistoryQosPolicy[kind=KEEP_LAST_HISTORY_QOS, depth=1, refilter=NONE_REFILTER_QOS, id=History, policy_name=History]
which is the default history QoS for readers, when not set by the user through any applicable method.