Finding a Topic

The find_topic() operation finds an existing (or ready to exist) Topic, based on its name. This call can be used to block for a specified duration to wait for the Topic to be created.

DDSTopic* DDSDomainParticipant::find_topic (const char * topic_name,
const DDS_Duration_t & timeout)

If the requested Topic already exists, it is returned. Otherwise, find_topic() waits until either another thread creates it, or returns when the specified timeout occurs.

find_topic() is useful when multiple threads are concurrently creating and looking up topics. In that case, one thread can call find_topic() and, if another thread has not yet created the topic being looked up, it can wait for some period of time for it to do so. In almost all other cases, it is more straightforward to call lookup_topicdescription() (see Looking up Topic Descriptions).

The DomainParticipant must be enabled when you call find_topic().

Note: Each DDSTopic obtained by find_topic() must also be deleted by calling the DomainParticipant’s delete_topic() operation (see Deleting Topics).

© 2018 RTI