limit peers on topic

2 posts / 0 new
Last post
Last seen: 11 years 6 months ago
Joined: 12/27/2012
Posts: 1
limit peers on topic

Hello, I'd like to if DDS can to support the following scenario: I'd like to use the same DataWriter to send data to specific participant, but each time to a different participant. This is essentially unicast. 



rip's picture
Last seen: 2 days 1 hour ago
Joined: 04/06/2012
Posts: 324


DDS out of the box doesn't support this scenario.  Generally DDS writers write to "everybody", while readers constrain themselves by use of content- and time-based- filtering.  ie, it's the reader that decides whether it wants to listen (disregarding the added configuration of ignoring peers, etc)

I've implemented the behavior, however, using a token bucket.  The receiving app publishes its desire to receive on a certain topic, along with a token.  It sets up a content-filter topic, that accepts only posts on the Topic that contain its own token in a specific field (ie, content-filtered topic).

A small class receives these tokens and stores a list thereof.  When the writer wants to publish something, it requests a token from the small helper class, and uses this in a well-known field in the Type.  The specific datareader then sees the publication, processes the data. 

The helper class implements different scheduling algorithms, ie single-use, round-robin, prioritized etc to decide which token to return to the writer.

The writer can request a new token on each write, or it can request a new token only when beginning a series of related publications, or it can request it once and from then on, use the same token.  Keep in mind that this only works when the receiver is using content-filtering!  Don't forget that subscribers that are listening on the unfiltered Topic, will still see all of the published instances!

The above algorthims may not exactly suit your own need, but if it does, I'm willing to help you with further discussion.  Additional discussion (DDS use in Load Balancing) can be found in this thread.