Cloud Data Streaming#
Introduction#
What you’ll learn
In this module, you’ll use a Connext Cloud Databus to connect several local Connext systems.
You will do the following:
Run the home automation publisher on your machine
Create a Connext Cloud Databus
Connect your machine to the Databus with an edge gateway
Verify that the “WindowStatus” Topic is received in the Databus dashboard
Connect the subscriber from a second machine and verify the cross-site data flow
In the Publish-Subscribe module, the home automation publisher writes “WindowStatus” samples and the subscriber prints a warning when a window opens.
In this module, you’ll keep those applications unchanged and use Connext Cloud to connect multiple edge sites. Each edge site can be a different machine, including your desktop, a VM or a remote server. A local gateway joins the local DDS domain and the Connext Cloud Databus, then caches and routes selected Topics between them.
You’ll start on your own machine: run the publisher, connect it to the Databus, and watch the data arrive in the Databus dashboard. Then you’ll complete the system by connecting the subscriber from a second machine.
Home automation publisher and subscriber connected through Connext Cloud.#
How to complete this module#
To complete this module, you’ll need the following:
A free Connext Cloud account.
The rticloud CLI installed on each edge machine.
A Connext 7.7.0 or newer installation on each edge machine. If Connext is not installed,
rticloud gatewaywill help you install it. You can also follow the Installation guide.One or more additional machines for the last step.
A clone of the
rticonnextdds-examplesGitHub repository on each edge machine.
Cloning the GitHub repository
Clone the GitHub repository with the following command:
$ git clone --recurse-submodule https://github.com/rticommunity/rticonnextdds-examples.git
The code for this module is located in the tutorials/publish_subscribe
directory. See the README.md files for additional instructions.
This guide is designed for Connext 7.7.0 or newer. For Connext 7.3.1, checkout the branch release/7.3.1.
This module uses the publisher and subscriber from the Publish-Subscribe module.
1. Run the publisher on your machine#
Start from the cloned rticonnextdds-examples repository on your machine
and run a home automation publisher. Your machine is the first edge site. The
examples use domain ID 0 by default.
Keep the publisher running while you create the cloud resources and start the gateway.
Install the Connext Python package with pip install rti.connext
if you haven’t already. See Python installation.
$ cd rticonnextdds-examples/tutorials/publish_subscribe/py
$ python home_automation_publisher.py Window1 LivingRoom
Build the applications:
$ cd rticonnextdds-examples/tutorials/publish_subscribe/c++11
$ mkdir -p build
$ cd build
$ cmake -DBUILD_SHARED_LIBS=ON ..
$ cmake --build .
Run a publisher:
$ ./home_automation_publisher Window1 LivingRoom
The full instructions, including other programming languages, are in the Publish-Subscribe module.
Note
If you prefer a minimal connectivity test, you can use rtiddsping
instead of the home automation applications: run rtiddsping -pub instead
of the publisher.
2. Create a Cloud Databus#
Create the Databus in the Connext Cloud dashboard. You’ll link it to an Observability Service so the dashboard can show the Databus Topics and data flow in a later step.
Go to Databuses and select Create a Databus.
Name the Databus
home-automation-databus. Click Next.In the Configure Core Services step, keep the default settings. Click Next.
In the Select Components step, open the Link to Observability Service dropdown and select an Observability Service, such as
home-automation-obsif you completed the Cloud Observability module. If you don’t have one, select Create new Observability Service, createhome-automation-obswith the default settings in the new browser tab, then return to the dropdown, refresh it, and selecthome-automation-obs.In the final step, review the settings and create the Databus.
Wait until the Databus shows an active status before continuing.
3. Create an edge gateway template#
Create an Edge Gateway application template for the Databus:
In the Connext Cloud dashboard, go to Databuses.
Open
home-automation-databus.Open the Applications tab and select Create Application.
Select Edge Gateway and click Continue.
Name the template
home_automation_gateway, leave the default port. Click Next.Choose the Basic configuration option to route all Topics in both directions from domain 0. Click Next.
Review the configuration and click Create Application.
Note
Routing all topics keeps this tutorial simple. For a real deployment, restrict the gateway template to only the Topics and directions that each site needs.
4. Connect your machine to the Databus#
Open a new terminal on your machine. Run rticloud configure if you haven’t before
and choose us-east-2` and then run ``rticloud gateway.
$ cd rticonnextdds-examples/tutorials/publish_subscribe/py
$ rticloud gateway
$ cd rticonnextdds-examples/tutorials/publish_subscribe/c++11
$ rticloud gateway
Follow the interactive prompts:
Select Data Only.
Select
home-automation-databus.Select the
home_automation_gatewaygateway template.
Leave the command running. It starts the local gateway and stores the project
configuration and logs under .connext/ in the current directory.
Note
- Keep the
rticloud gatewayprocess running. If you stop a gateway, run rticloud gatewayagain from the same directory to restart it. Userticloud gateway resetif you want to start over.
Now confirm that Connext Cloud sees your publisher’s data:
In the Connext Cloud dashboard, go to Databuses.
Open
home-automation-databus.Use the Overview tab to inspect the data flow chart.
Open the Topics tab and confirm that “WindowStatus” is present.
It might take a few seconds for the dashboard to update; you can click the Refresh button on the top right until the data flow and topic list appear.
Your machine’s “WindowStatus” samples are now flowing into the Databus.
5. Connect the subscriber from a second machine#
On the second machine, start from its clone of the rticonnextdds-examples
repository and run the home automation subscriber:
$ cd rticonnextdds-examples/tutorials/publish_subscribe/py
$ python home_automation_subscriber.py
Build the applications as in step 1, then run the subscriber:
$ ./home_automation_subscriber
The subscriber doesn’t print anything yet. That is expected: the publisher runs on a different machine and network, so the applications cannot discover each other directly.
Open a new terminal on the second machine and run rticloud configure and
rticloud gateway. Follow the same prompts as in the previous step,
selecting the same Databus and gateway template.
The moment the gateway connects, the subscriber starts printing warnings from the publisher on your machine:
WARNING: Window1 in LivingRoom is open!
This confirms that the “WindowStatus” samples are flowing from your machine, through both gateways and the Cloud Databus, to the remote subscriber.
Note
If you prefer a minimal connectivity test, you can use rtiddsping
instead of the home automation applications: run rtiddsping -sub instead
of the subscriber.
Optionally, confirm that another Cloud client can observe the topic. From an additional machine, run:
$ rticloud spy
When prompted, select home-automation-databus. If the CLI offers to create
the rticloud_spy cloud application, select that option. The spy command connects
through the Databus and prints discovered Topics, and data samples.
This confirms that a separate client can join through Connext Cloud and observe
the same Topic.
Learn more#
This module showed how to connect the home automation publisher and subscriber across multiple edge sites without changing the application code. The local applications still use ordinary DDS Topics. Connext Cloud provides the Databus and gateway artifacts that connect the sites.
Next Steps
Once your Topics are available in the Connext Cloud Databus, you can use Connext Studio and AI to analyze and visualize your global data flows. See the AI Agents module for a walkthrough.