2

In DDS what my requirement is, I have many subscribers but the publisher is single. My subscriber reads the data from the DDS and checks the message is for that particular subscriber. If the checking success then only it takes the data and remove from DDS. The message must maintain in DDS until the authenticated subscriber takes it's data. How can I achieve this using DDS (in java environment)?

Reinier Torenbeek
  • 16,669
  • 7
  • 46
  • 69
Bathakarai
  • 1,517
  • 6
  • 23
  • 39
  • You say "my subscriber ... checks the message is for that particular subscriber". How does that check work, is it a simple test for the value of a field in the data, or is it more complicated? I am asking this in order to get a better idea about how DDS data management features could be leveraged. – Reinier Torenbeek Jul 16 '12 at 11:52
  • In my idl file i have 2 fields File_name and file_content. In publisher side i give the file name and read the content, that will be stored in file_name and file_content variables accordingly. In subscriber side I specify the file name based on the file_name the file_content must be received and that file_name and file_content instance must removed from the DDS. – Bathakarai Jul 16 '12 at 12:38

1 Answers1

0

First of all, you should be aware that with DDS, a Subscriber is never able to remove data from the global data space. Every Subscriber has its own cached copy of the distributed data and can only act on that copy. If one Subscriber takes data, then other Subscribers for the same Topic will not be influenced by that in any way. Only Publishers can remove data globally for every Subscriber. From your question, it is not clear whether you know this.

Independent of that, it seems like the use of a ContentFilteredTopic (CFT) is suitable here. According to the description, the Subscriber knows the file name that it is looking for. With a CFT, the Subscriber can indicate that it is only interested in samples that have a particular value for the file_name attribute. The infrastructure will take care of the filtering process and will ensure that the Subscriber will not receive any data with a different value for the attribute file_name. As a consequence, any take() action done on the DataReader will contain relevant information and there is no need to check the data first and then take it.

The API documentation should contain more detailed information about how to use a ContentFilteredTopic.

Reinier Torenbeek
  • 16,669
  • 7
  • 46
  • 69
  • Hello Reinier, In this link "http://stackoverflow.com/questions/11445299/remove-read-topic-from-dds" you specify how to remove the read topic in DDS. At that time you told to use take() method in place of read(). Then how you told Subscriber not able to remove the data in DDS???? – Bathakarai Jul 17 '12 at 04:50
  • When you have many applications subscribing for the same `Topic`, each `Subscriber` will have its own local copy of the data. Yes, you can remove the data from a `DataReader` using `take()` -- but that will not remove the data from all the other `DataReaders`. You can try it by running multiple instances of the same subscribing application and you will see that all of them have their own copy of the data, even when they use `take()`. – Reinier Torenbeek Jul 17 '12 at 04:56
  • Cool, Then it is possible to remove the data from all the DataReaders (or) the DDS, Once a subscriber takes it's data. – Bathakarai Jul 17 '12 at 05:26