Hi all, so my question is, how would the system behaves if I use RELIABLE in data writer and BEST_EFFORT in datareader?
Will data writer still wait for acknowledgement (even if the datareader is BEST_EFFORT)?
Or will the connection become BEST_EFFORT effectively? So that data writer will discard the sample immediately after sent via transport?
Thank you all!
When a DataWriter is configured with RELIABLE Reliability is connected to a DataReader that's configured with BEST_EFFORT Reliability (and say that this is the only DataReader in the system for the topic), the connection between the two endpoints is BEST_EFFORT. This means no extra meta data packets needed to support a reliable connection (e.g., Heartbeats, ACKs, NACKs, repair packets) are sent on the wire.
HOWEVER, because the DataWriter has been configured to support a RELIABLE connection, and it's possible that there could be RELIABLE DataReaders at the same time as BEST_EFFORT DataReaders, and new DataReaders could be created at anytime, the data samples sent by the DataWriter will still be stored in the DataWriter's history queue and managed per the History and ResourceLimits QoS settings, and not immediately discarded after being sent.
Thanks Howard! May I know if there is any way to inspect this? I mean to check if the RELIABLE DataWriter is effectively BEST_EFFORT or RELIABLE. Or to inspect how many acknowledgement needed for DataWriter to delete the sample from the send window?
Well, there are multiple ways (did you look through the DataWriter APIs?)
1) Check the ReliableReaderActivityChangedStatus,
if the Writer has no reliable readers, the active_count will be 0
2) Check the DataWriterProtocolStatus,
If you look at the documentation, a variety of members will indicate if the Writer is connected or has been connected reliably
3) Use any of the DataWriter methods with the word "acknowledgement", e.g, wait_for_acknowledgement(), is_sample_acknowledged()
4) Check the ReliableWriterCacheChangedStatus (history queue)
The "unacknowledged_sample_count" tells you how many samples in the sample queue are unacknowledged
5) Use wireshark and capture the traffic when the DataWriter is sending data to the DataReader. If you do so, you will only see DATA samples for the topic and no related HB or ACKNACK samples.