I am currently using RTI DDS for a pub sub system I am implementing, and for some topics want to keep a history depth of only 1 to keep to be resent if ever needed and for other topics, want to keep all the history to be resent if ever needed. Below is the Qos policy
file I am using.
<?xml version="1.0"?>
<dds>
<qos_library name="Keep_History_Library">
<qos_profile name="Keep_History_profile" is_default_qos="true">
<datawriter_qos name="ReliableWriter">
<property>
<value>
<element>
<name>dds.data_writer.history.memory_manager.fast_pool.pool_buffer_max_size</name>
<!-- Typical size of your data type. -->
<value>32000</value>
</element>
</value>
</property>
<durability>
<kind>TRANSIENT_LOCAL_DURABILITY_QOS</kind>
</durability>
<history><kind>KEEP_LAST_HISTORY_QOS</kind><depth>1</depth></history>
<reliability>
<kind>RELIABLE_RELIABILITY_QOS</kind>
</reliability>
<publication_name>
<name>HistoryDataWriter</name>
</publication_name>
</datawriter_qos>
<datareader_qos name="ReliableReader">
<history><kind>KEEP_LAST_HISTORY_QOS</kind><depth>1</depth></history>
<reliability>
<kind>RELIABLE_RELIABILITY_QOS</kind>
</reliability>
<durability>
<kind>TRANSIENT_LOCAL_DURABILITY_QOS</kind>
</durability>
<subscription_name>
<name>HistoryDataReader</name>
</subscription_name>
</datareader_qos>
</qos_profile>
<qos_profile name="Keep_All_History_profile">
<datawriter_qos name="ReliableWriter">
<property>
<value>
<element>
<name>dds.data_writer.history.memory_manager.fast_pool.pool_buffer_max_size</name>
<!-- Typical size of your data type. -->
<value>32000</value>
</element>
</value>
</property>
<history><kind>KEEP_ALL_HISTORY_QOS</kind></history>
<reliability>
<kind>RELIABLE_RELIABILITY_QOS</kind>
</reliability>
<durability>
<kind>TRANSIENT_LOCAL_DURABILITY_QOS</kind>
</durability>
<publication_name>
<name>HistoryDataWriter</name>
</publication_name>
</datawriter_qos>
<datareader_qos name="ReliableReader">
<history><kind>KEEP_ALL_HISTORY_QOS</kind><depth>1000000</depth></history>
<reliability>
<kind>RELIABLE_RELIABILITY_QOS</kind>
</reliability>
<durability>
<kind>TRANSIENT_LOCAL_DURABILITY_QOS</kind>
</durability>
<subscription_name>
<name>HistoryDataReader</name>
</subscription_name>
</datareader_qos>
</qos_profile>
</qos_library>
</dds>
The following, is the code written in java to load the Keep_All_History_profile
from the Qos policy
file for the reader.
DataReaderQos datareader_qos = new DataReaderQos();
DomainParticipantFactory.TheParticipantFactory.get_datareader_qos_from_profile(datareader_qos, "Keep_History_Library", "Keep_All_History_profile");
As well as the code to load the Qos
file into the writer
DataWriterQos datawriter_qos = new DataWriterQos();
DomainParticipantFactory.TheParticipantFactory.get_datawriter_qos_from_profile(datawriter_qos, "Keep_History_Library", "Keep_All_History_profile");
However the problem I am having is when I try to load the Keep All History profile
, a depth of one is only keep and not anymore. However if I change the keep last history
part of the profile to a depth to say a depth of 10 it will keep and read the last 10 messages where the keep all history is supposed to be loaded. Why would this be happening where it appears as though the wrong profile is being loaded?
EDIT
Code used to make the datawriter which is used right after the loading of the Qos
profile.
writer = (DataDataWriter)
publisher.create_datawriter(
topic, Publisher.DATAWRITER_QOS_DEFAULT,
null, StatusKind.STATUS_MASK_NONE);
if (writer == null) {
System.err.println("create_datawriter error\n");
return;
}
as well as the datareader
listener = new DataListener();
reader = (DataDataReader)
subscriber.create_datareader(
topic, Subscriber.DATAREADER_QOS_DEFAULT, listener,
StatusKind.STATUS_MASK_ALL);
if (reader == null) {
System.err.println("create_datareader error\n");
return;
}
}
The data reader then sends a message with the following method,
public void writeData(String results) throws InterruptedException
{
instance.results = results;
writer.write(instance, handle);
}