Getting all topic in a domain participant

5 posts / 0 new
Last post
Last seen: 2 years 8 months ago
Joined: 01/08/2020
Posts: 1
Getting all topic in a domain participant


I have run into some issues were I want to look up all topics in inside a domain. 

I have followed the How-To and been using dds::topic::discover_any_topic() to get a list of the instancehandlers. From here I get stuck, since I would like to use dds::topic::discover_topic_data(), but this throws Unsupported Error since since it only retrieves data about local topics. 

Running DDS 6. Can someone point me in the right direction or have a working example of how this can be done? 

Thanks in advance! 




irwin's picture
Last seen: 2 years 2 months ago
Joined: 08/14/2010
Posts: 42

 There is no direct API to do that. So your steps are as follows:
1- factory.get_participants
2- for each participant get_publishers and get_subscribers
3- For each publisher and subscriber get_all_datareaders and get_all_datawriters
4- For each datareader/datawriter get_topic
5- for topic get_the_type_name (ie message type), get_name ( ie topic name.).


Last seen: 1 year 7 months ago
Joined: 02/08/2021
Posts: 6

Tried that, no useful information at all. No type or topic names because it claims no datawriters BUT I have a publisher publishing so I dont understand.

I have 3 programs... one publihses, one reads (and sees it) one I am trying to get to show me the names of the topics on the domain. ALL I have achieved is to count participants and get a number of 'handles' to things which doesnt allow me to find anything useful.

Just thought I would try looking at the readers get_all_datareaders() doesnt appear to exist

I would appreciate some WORKING C /c++ code that allows me to see the topics on my domain.

I have spent 5 days on this and achieved nothing but grumpiness

Last seen: 2 days 7 hours ago
Joined: 09/23/2022
Posts: 1

Hi ,

If I am running two process where in one process a DDS topic is created and in another process we want to lookup for that topic, that should be possible?

If yes, then

I am looking into some APIs like lookup_participants in parctipants factory. Will that help?

Thanks in advance !

Howard's picture
Last seen: 1 day 17 hours ago
Joined: 11/29/2012
Posts: 429

A few comment.

1) Topics themselves are not objects that are propagated during discovery.  i.e., you can't discover the existence of a topic created in one participant from another participant directly.  You can only discover a topic when a participant also creates a DataWriter or DataReader with the topic.

Then by discoverying that there's a DataWriter or DataReader in a remote participant, the local participant can then determine that there's a topic for a given name and type.

2) There are postings and examples on how to use the DDS Builtin Topics for discovery to add your own code to listen for discovery events, where can find out when DataWriters (aka publications) and DataReaders (aka subscriptions) have been created by another participant (in the same DDS domain).

For example,

there are other postings on the website as well.  Just use the search feature to find "builtin topic".