You are here: Part 2: Core Concepts > Working with DDS Domains > DomainParticipants > Choosing a Domain ID and Creating Multiple DDS Domains

Choosing a Domain ID and Creating Multiple DDS Domains

A domain ID identifies the DDS domain in which the DomainParticipant is communicating. DomainParticipants with the same domain ID are on the same communication “channel”. DomainParticipants with different domain IDs are completely isolated from each other.

The domain ID is a purely arbitrary value; you can use any integer 0 or higher, provided it does not violate the guidelines for the DDS_RtpsWellKnownPorts_t structure (Ports Used for Discovery). Domain IDs are typically between 0 and 232. Please see the API Reference HTML documentation for the DDS_RtpsWellKnownPorts_t structure and in particular, DDS_INTEROPERABLE_RTPS_WELL_KNOWN_PORTS.

Most distributed systems can use a single DDS domain for all of its applications. Thus a single domain ID is sufficient. Some systems may need to logically partition nodes to prevent them from communicating with each other directly, and thus will need to use multiple DDS domains. However, even in systems that only use a single DDS domain, during the testing and development phases, one may want to assign different users/testers different domain IDs for running their applications so that their tests do not interfere with each other.

To run multiple applications on the same node with the same domain ID, Connext DDS uses a participant ID to distinguish between the different DomainParticipants in the different applications. The participant ID is simply an integer value that must be unique across all DomainParticipants created on the same node that use the same domain ID. The participant_id is part of the WIRE_PROTOCOL QosPolicy (DDS Extension).

Although usually those DomainParticipants have been created in different applications, the same application can also create multiple DomainParticipants with the same domain ID. For optimal results, the participant_id should be assigned sequentially to the different DomainParticipants, starting from the default value of 0.

Once you have a DomainParticipant, you can retrieve its domain ID with the get_domain_id() operation.

The domain ID and participant ID are mapped to port numbers that are used by transports for discovery traffic. For information on how port numbers are calculated, see Ports Used for Discovery. How DomainParticipants discover each other is discussed in Discovery.

© 2016 RTI