rticonnextdds-examples icon indicating copy to clipboard operation
rticonnextdds-examples copied to clipboard

Add example for bi-directional pub/sub communication

Open Spencatro opened this issue 5 years ago • 1 comments

Information

  • RTI Product: RTI Connext DDS
  • Version: 6.0.0+ / Any

Most of the examples define a single publisher and a single subscriber, each in their own program with a main(). (At least this is the case for c++; I haven't looked at other languages). That means that in each example, data flows in a single direction, across a single topic, from process A to process B.

I am looking for an example of a case where a process can have both a subscriber (e.g. to topic_a), and a publisher (e.g. to topic_b), and a second process that has a mirrored subscriber (topic_b) / publisher (topic_a), and the processes effectively ping-pong back and forth. (I am trying to implement this myself, and I am running into some odd timing issues; I am nearly certain I am missing some best-practice etc.)

Note that there is one example in open pull requests that implements the RequestReply pattern which is helpful, but I am looking for a way to implement bi-directional pub/sub without necessarily using RequestReply, if it is possible.

Apologies if this is a duplicate / already implemented somewhere and I couldn't find it. I searched through closed issues and open PR's and didn't see anything that exactly matched what I am looking for. Thanks!

Spencatro avatar Jun 02 '20 20:06 Spencatro

Hello Spencer!

Are you looking at c++98 or c++11 examples? I'm currently adding "getting started" content that includes some more-complex code with both DataWriters and DataReaders, but I'm starting with c++11 and I will be adding c++98 (the "traditional C++" APIs) after. This will eventually followed by other languages, but I'm starting with those two.

https://github.com/rticommunity/rticonnextdds-getting-started/tree/master/3_keys_instances/c%2B%2B11

(Note that this example is meant to live alongside a getting started guide chapter that we are still writing. :) )

rosemwahlin avatar Jun 02 '20 20:06 rosemwahlin