How can I detect new DataWriters and DataReaders joining the domain?

 

Note: Applies to RTI Data Distribution Service 4.0x and higher.

RTI Connext must discover and keep track of remote entities, such as new participants in the domain or new DataReaders of a particular topic in order to work. This information may also be important to the application itself, which may want to react to this discovery, or access it on demand. Examples include a monitoring application like rtiddsspy, or bridging applications that translate between a Connext data space and a more traditional messaging bus. 

To support these needs, RTI Connext provides builtin Topics (“DCPSParticipant”, “DCPSPublication”, “DCPSSubscription” ) and corresponding builtin DataReaders that you can use to access this discovery information. (More details can be found in the Core Libraries and Utilities User's Manual chapters on Discovery and Builtin Topics.) 

The discovery information is accessed just as if it is normal application data. This allows the application to know (either via listeners or by polling) when there are any changes in those values. Note that only entities that belong to a different DomainParticipant are discovered and accessible through the builtin readers. Entities that are created within the local DomainParticipant are not included as part of the data that can be accessed by the builtin readers. 

The attached example illustrates how to create builtin DataReaders to examine new publications and subscriptions in the DDS data space. Each time a new entity is discovered, the topic name, type name and IDL structure are printed in this example.

A a side note not related to builtin topics but related to the example attached to this solution, we increase the typecode serialized length from 256 (the default) to 64K (the maximum) to make sure we can receive more involved typecodes. The typecode data size varies from data type to data type (the more complex the structure, the larger the typecode). The DomainParticipant's resource_limits.type_code_max_serialized_length controls the maximum typecode size that can be sent and received by the participant. RTI Connext’s default value is 256, which is adequate for only very simple data structures (for instance, a simple struct with no more than 8 primitive members).

See also the HowTo https://community.rti.com/howto/detect-presence-domainparticipants-datawriters-and-datareaders-dds-domain for additional details and a Java example.

Attachments: 

Comments

How do I run the `builtinTopics.zip` code? I took a look at it and saw that `myTypeCodeSpy.cc` was the main file I should run, but when I tried compiling it with `gcc myTypeCodeSpy.cc -I/opt/RTI/rti_connext_dds-5.3.1/include -I/opt/RTI/rti_connext_dds-5.3.1/include/ndds -o myTypeCodeSpy.o` I get a whole lot of errors. Is this code outdated?