get_publishers() without using rti extension API

5 posts / 0 new
Last post
Offline
Last seen: 6 years 7 months ago
Joined: 03/06/2014
Posts: 6
get_publishers() without using rti extension API

I have been looking into introspecting a running DDS domain using the C API only. So far I was able to join the domain and iterate over all discovered particiants. From there the function:

DDS_DomainParticipant_get_publishers

(http://community.rti.com/rti-doc/510/ndds.5.1.0/doc/html/api_c/group__DDSDomainParticipantModule.html#ga0015707630e524d509da982230386ba1)

looks promising to get all the publishers of one participant. But this API is marked as an rti-specific extension.

Can someone recommend an alternative API or a sequence of APIs to use which would work across diffferent vendors to achieve the same thing: get a hand on the publishers of one participant?

Thank you,

- Dirk

Gerardo Pardo's picture
Offline
Last seen: 4 months 1 week ago
Joined: 06/02/2010
Posts: 602

Hello Dirk,

I will start with a side observation:

The way to iterate over everything that has been discovered is to use the DDS builtin Topics. These can be used to "read" all the DomainParticipants, DataReaders and DataWriters that have been discovered in the Domain. This HOWTO describes it in more detail and includes some example code. The builtin Topics are part of the DDS spec and should be implemented by all vendors.

However when it comes to iterating over Publishers and Subscribers the situation is a bit different. Publishers and Subscribers are mostly a local concept used to group local DataWriters (DataReaders) in order to share resources and therads. This information is not propagated via discovery so you cannot discover how those remote entities are grouped.

Regarding the locally-created Publishers and Subscribers, the information is available inside DDS given that they were created by the local DomainParticipant. However the specification does not state that a vendor has to provide the get_publishers() and get_subscribers() operations. RTI does provide them and this is why they are marked as an "extension".

Given this, if you are interested in remote entities then publishers and subscribers do not really matter. However, if you want local introspection on what was locally created then you need the get_publishers() and get_subscribers() operations. The only thing you could do in situations where a vendor does not offer it is wrap the operations on the DomainParticipant that create the Publisher and Subscriber and save the created entities in a list. But this is ugly and annoying given that the DDS implementation knows it...

Gerardo

Offline
Last seen: 6 years 7 months ago
Joined: 03/06/2014
Posts: 6

Thank you for your fast and detailed response.

The referenced how-to seems to have some minor syntax errors in the C code:

    PublicationBuiltinTopicDataDataReader::narrow

I will look into using the builtin topics then see if I can get all the information I like to have.

Thank you,

- Dirk

Fernando Garcia's picture
Offline
Last seen: 3 months 10 hours ago
Joined: 05/18/2011
Posts: 200

Hello Dirk,

There is also an example on how to use the built-in topics on the Community Site.

Fernando.

Gerardo Pardo's picture
Offline
Last seen: 4 months 1 week ago
Joined: 06/02/2010
Posts: 602

Thank you for mentioning the problems in the C code. I updated the HOWTO with the correct C syntax.

Regards,

Gerardo