How do I get a DataReader to ignore a DataWriter that belongs to the same DomainParticipant?

We do support the ability for local DataWriters and DataReaders of the same topic to ignore each other, i.e., the local DataReader to only receive messages from remote DataWriters, not local ones. To do so, you can call  ignore_participant(). For example: 

DDSDomainParticipant *dP;

dP->ignore_participant(dP->get_instance_handle());

In C, there are a few more steps, as get_instance_handle() is a DDS_Entity function.  In C++ and Java, we inherit such functions from base classes, but in C we need to access the DomainParticipant's "contained" or "parent" Entity in order to call it:  

DDS_Entity* participantEntity = DDS_DomainParticipant_as_entity (participant);
DDS_InstanceHandle_t IHandle = DDS_Entity_get_instance_handle(participantEntity);
DDS_DomainParticipant_ignore_participant(participant, &IHandle);

Call  ignore_participant() BEFORE any of the local readers and writers are created. 

Also, in Modern C++, you can ignore a DomainParticipant as follows:

#include <dds/domain/ddsdomain.hpp>;
...
  
dds::domain::DomainParticipant participant(domain_id);
dds::domain::ignore(participant, participant.instance_handle());



Note that the 'ignore' will apply to ALL of the DomainParticipant's locally created reader and writers.

Keywords: