Publish data to Mongo Database

3 posts / 0 new
Last post
Offline
Last seen: 4 years 6 months ago
Joined: 08/11/2019
Posts: 28
Publish data to Mongo Database

Hello,

I want to implement publish data and store all the data in my Mongo DB,

but it seems only can use SQL DB.

how can I do that by using DDS publisher?  Is there any sample code? 

Thanks

Keywords:
Gerardo Pardo's picture
Offline
Last seen: 3 days 4 hours ago
Joined: 06/02/2010
Posts: 602

We do not have any products that would do that out of th box. The RTI Database Integration Service only supports MySQL, Microsoft SQL Server, and PostgreSQL. Support for databases can be added via plugins but they need to be relational databases (SQL) which MongoDB is not.

Therefore the only way to do this would be for you to write a "bridge" application that subscribes to DDS and writes to MongoDB. There are a couple of ways to do this:

  • You could do this directly, that is, write a DDS application that subscribes to the DDS Topics you want to put in MongoDB and then when it receives the data using DDS use one of the MongoDB Drivers (e.g. the C++11 one http://mongocxx.org/) to write the data to MongoDB.
  • Alternatively you could use RTI Routing Service as the bridge application. In this case you need to implement a Routing Service Output Adapter to the RTI Routing Service. The Adapter would use The C or C++ MongoDB Drivers to write the data to MongoDB.

Dependin on the use-case the second approach may be faster as it allows you to leverage all the routing service infrastructure and limits what you need to do to implementing the Routing Service Adapter interfaces.

Gerardo

Offline
Last seen: 4 years 6 months ago
Joined: 08/11/2019
Posts: 28

Hello Gerardo Pardo,

Thank you very much for your suggestion. It is very clear and it helps me a lot.

I will try to implement it!

Thank you very much.

Kay