DDS Persistence unable to set

7 posts / 0 new
Last post
xty250hp's picture
Offline
Last seen: 3 years 2 months ago
Joined: 03/09/2015
Posts: 21
DDS Persistence unable to set

Hi, 

The Problem : I am trying to set a pesistent writer to a specific topic so that every late subscriber will recive al the messages for that topic as long as the data writer is alive.Means that I am using Transient_Local_Durability_Qos. 

In code I am creating a Writer with that specific QOS setting, 

if (_publisher == null)
{
_publisher = _participant.create_publisher(DomainParticipant.PUBLISHER_QOS_DEFAULT, null,
StatusMask.STATUS_MASK_NONE);
}
if (_reliableDataWriter == null)
{
DataWriterQos rQos = Publisher.DATAWRITER_QOS_DEFAULT;
rQos.durability.kind = DurabilityQosPolicyKind.TRANSIENT_LOCAL_DURABILITY_QOS;

_reliableDataWriter = _publisher.create_datawriter((Topic)topic, rQos, listener, StatusMask.STATUS_MASK_NONE);
}

_reliableDataWriter.write_untyped(message, ref InstanceHandle_t.HANDLE_NIL);

The messages are published BUT... in the Monitor the QOS is still as Volatile, wich means that no new subscriber will recive the message.

the subscriber is as Transient_Local_Durability_Qos setup.

"

Subscriber subscriber = _participant.create_subscriber(DomainParticipant.SUBSCRIBER_QOS_DEFAULT, null,
StatusMask.STATUS_MASK_NONE);
DataReaderQos rQos = Subscriber.DATAREADER_QOS_DEFAULT;
rQos.durability.kind = DurabilityQosPolicyKind.TRANSIENT_LOCAL_DURABILITY_QOS;

return _persistanceDataReader ??
(_persistanceDataReader =
subscriber.create_datareader(topic, rQos, listner,
StatusMask.STATUS_MASK_ALL));

At some point it has created the dataWriter with Transient_local but still no messages were revived. 

Please somme help... 

Thank You

 

 

 

 

 

 

 

 

 

Gerardo Pardo's picture
Offline
Last seen: 10 hours 17 min ago
Joined: 06/02/2010
Posts: 601

Hi,

I think the problem is with these lines:

DataWriterQos rQos = Publisher.DATAWRITER_QOS_DEFAULT;
rQos.durability.kind = DurabilityQosPolicyKind.TRANSIENT_LOCAL_DURABILITY_QOS;

and

DataWriterQos rQos = Publisher.DATAWRITER_QOS_DEFAULT;
rQos.durability.kind = DurabilityQosPolicyKind.TRANSIENT_LOCAL_DURABILITY_QOS;

The assignments to rQos are not doing a deep copy. Instead rQos is becoming a referece to internal data structures and the subsequent modifications to rQos are being ignored.

Instead try this:

DataWriterQos wQos;
_publisher.get_default_datawriter_qos(wQos);
wQos.durability.kind = DurabilityQosPolicyKind.TRANSIENT_LOCAL_DURABILITY_QOS;

and

DataReaderQos rQos;
_subscriber.get_default_datareader_qos(rQos);
rQos.durability.kind = DurabilityQosPolicyKind.TRANSIENT_LOCAL_DURABILITY_QOS;

Gerardo

xty250hp's picture
Offline
Last seen: 3 years 2 months ago
Joined: 03/09/2015
Posts: 21

Thank You , It helped me. That was exactly the problem. ;)

xty250hp's picture
Offline
Last seen: 3 years 2 months ago
Joined: 03/09/2015
Posts: 21

 

I still have another question. Why is not changing tha history depth? What am I missing. 

On execution path the value is changed but after creating the topic datawriter on the RTI monitor I see the history depth of 1 and I only recive one message. 

code if (_publisherPersistentMedicine == null)
{
_publisherPersistentMedicine = _participant.create_publisher(DomainParticipant.PUBLISHER_QOS_DEFAULT, null,
StatusMask.STATUS_MASK_NONE);
}
if (_persistanceMedicineDataWriter != null) return;
try
{
var wQos = new DataWriterQos();
_publisherPersistentMedicine.get_default_datawriter_qos(wQos);
wQos.durability.kind = DurabilityQosPolicyKind.TRANSIENT_LOCAL_DURABILITY_QOS;
wQos.reliability.kind = ReliabilityQosPolicyKind.RELIABLE_RELIABILITY_QOS;
var history = new HistoryQosPolicy
{
depth = messagesDepth,
kind = HistoryQosPolicyKind.KEEP_LAST_HISTORY_QOS,
refilter = RefilterQosPolicyKind.ALL_REFILTER_QOS
};
wQos.history = history;
_persistanceMedicineDataWriter = _publisherPersistentMedicine.create_datawriter((Topic)topic, wQos, listener,
StatusMask.STATUS_MASK_NONE);
} code 

Thank You

 

rip
rip's picture
Offline
Last seen: 10 hours 15 min ago
Joined: 04/06/2012
Posts: 324

what is the value of messagesDepth?  your extract doesn't supply that information. 

What happens when you try

wQos.history.depth = messagesDepth;
wQos.history.kind = HistoryQosPolicyKind.KEEP_LAST_HISTORY_QOS;
wQos.history.filter = RefilterQosPolicyKind.ALL_REFILTER_QOS;

instead of using a stack variable. 

 

xty250hp's picture
Offline
Last seen: 3 years 2 months ago
Joined: 03/09/2015
Posts: 21

Hi, 

The value is set. 

Depth is ex:100 

kind is the one I have set and filter is ok. It creates the datawriter and afterwards the data writer has the depthof 1. 

rip
rip's picture
Offline
Last seen: 10 hours 15 min ago
Joined: 04/06/2012
Posts: 324

You haven't shown your work, so I don't know if the value is set or not.  You haven't supplied information about what happened when you tried the other suggestion, so I don't know if you tried that or not. 

You also have not told us where you verified or checked what the history depth is (Analyzer? Admin Console? Read it back out of the writer after creation?) or what the comparable DataReader QoS settings are, which might also be the problem.

History depth is not RxO.  Don't assume that setting the Writer's history to 100 has any affect at all on what the Reader is doing.  If the Reader has a history depth of 1, you are getting what you asked for.