问题
I have two publisher and subscriber application.
- App1 -> publish -> Student (1,ABC), Student(2,EFG). After it I run second application. both application subscribe and publish on same domain
- App2 able subscribe Student (1,ABC), Student(2,EFG) which is published by App1 then I Published data. App2-> publish -> Teacher(1,AAA),Teacher(2,BBB) Now I got Student (1,ABC), Student(2,EFG),Teacher(1,AAA),Teacher(2,BBB) from App2
- when I close app2 and reopen again I am unable to subscribe this data How can I subscribe data which I published before closing application ? DDS Spy shows data still available on same domain.
Can somebody help to understand?
回答1:
How can I subscribe data which I published before closing application ?
The behavior that you are looking for is supported by the Durability Quality of Service (QoS) setting. It specifies if published data needs to remain available to be delivered to late joining Subscribers who joined the Domain after the data has been published, and for how long.
There are four different policies that you can select for the Durability QoS. In order of increasing lifetime of the data, they are:
VOLATILE
(the default): Updates are delivered only to DataReaders that are present at the time of publicationTRANSIENT_LOCAL
: Updates remain available for delivery to DataReaders as long as the DataWriter existsTRANSIENT
: Updates remain available for delivery to DataReaders as long as the Domain existsPERSISTENT
: Updates remain forever available for delivery to DataReaders, even after the Domain has been restarted.
For any of these policies, data is also removed if the dispose()
call is used, or if its lifespan period expires.
From your short description, it looks like you need to select the TRANSIENT_LOCAL
policy for your Durability QoS.
For more information, see section 2.2.3.4 DURABILITY in the DDS specification, which is freely downloadable from the OMG DDS webpage.
来源:https://stackoverflow.com/questions/54706939/rti-dds-two-applications-publishing-data-on-same-domain-when-one-application-cl