Advice on how a publisher can detect the presence of specific listener

1 post / 0 new
Offline
Last seen: 3 years 9 months ago
Joined: 03/12/2018
Posts: 32
Advice on how a publisher can detect the presence of specific listener

It looks like there are a few ways to do this, but I'm looking for the simplest, and I'm unfamiliar with some of the terms used in some of the explanations.

I have a subscriber that runs long-term.  At times, a publisher comes up and publishes a message quickly and exits.

The problem is that unless it waits for discovery to complete, it publishes and exits before discovery is complete, and the subscriber does not receive the message.

So I added code to make the publisher loop while checking the data writer's "publication_matched_status().current_count() to make sure it's at least 1.

Now, the problem is that sometimes I am running the admin console with a subscription to the data.  I might also be running the rtirecorder.  In those cases, the publisher  comes up and publishes even if the intended application is not running.

So, it becomes obvious that the number of subscribers is irrelevant.

I'd like advice on how to handle this best.

As an additional point of information, the receiving application exists in multiple instances that all share the same QoS entry.  For instance the QoS is "MyData", and it is shared by MySubscriber_0, MySubscriber_1, and MySubscriber_2, who receive messages from MyPublisher_0, MyPublisher_1, and MyPublisher_2, respectively.

I have an inkling that I can set the subscriber's "ENTITY_NAME", as here (https://community.rti.com/static/documentation/connext-dds/5.3.0/doc/manuals/connext_dds/html_files/RTI_ConnextDDS_CoreLibraries_UsersManual/Content/UsersManual/ENTITY_NAME_QosPolicy__DDS_Extension_.htm#sending_2410472787_2311284) , but I'm still confused about a few things:

1) In identifying the subscriber, a "name" can be applied to the datareader, subscriber, or domain participant.  Which is more appropriate?

2) How do I actually set it?  The page I point to above only seems to tease, suggesting that it can be done.

3) How does the publisher node check for the existence of this name string in it's peer DDS applications?