Topics¶
Shared knowledge of the data types is a requirement for different applications to communicate with DDS. The applications must also share a way to identify what data is to be shared. Data (regardless of type) is uniquely distinguished by using a name called a Topic.
Topics allow for Publishers and Subscribers to communicate
without knowing about each other. They dynamically discover
each other through Topics. The data that the DataReader
and
DataWriter
share is described by a Topic.
Topics are identified by a name, and they are associated with a type and a
DomainParticipant
.
The following code creates a Topic
named “Car Position” for a type Point
:
topic = dds.Topic(participant, "Car Position", Point)
Where Point
can be defined in IDL as:
struct Point {
int64 x;
int64 y;
};
And in Python as follows:
import rti.types as idl
@idl.struct
class Point:
x: int = 0
y: int = 0
Data Types explains how to define your types in more detail.
Special Topics¶
In addition to the class Topic
, there are a few separate Topic classes
for certain types:
For
DynamicData
Topics:DynamicData.Topic
(see DynamicType and DynamicData)For the built-in discovery Topics:
ParticipantBuiltinTopicData.Topic
,SubscriptionBuiltinTopicData.Topic
,PublicationBuiltinTopicData.Topic
,TopicBuiltinTopicData.Topic