|
| 1 | +# Shared Memory / UDP Gateway |
| 2 | + |
| 3 | +This example contains the necessary files to run the RTI Routing Service |
| 4 | +example from the "Breaking through Hospital IT Silos: The Top 3 Challenges |
| 5 | +to Overcome" blogpost. Routing Service (RS) will help us interfacing |
| 6 | +between the shared memory domain and the UDP domain. Applications local to a |
| 7 | +host will communicate with each other over SHMEM. RS will be the gateway for |
| 8 | +communication between local and remote applications. For this, RS will create |
| 9 | +a SHMEM DP (no UDP ports) and a UDP DP (with the 3 default UDP ports). If |
| 10 | +multicast is disabled, it will only open 2 UDP ports. |
| 11 | + |
| 12 | +In this example, you will use RTI DDS Ping as a pub/sub example application. |
| 13 | +Along with, Routing Service you will be able to create a gateway between a |
| 14 | +Shared Memory domain and a UDP domain that uses only 3 ports. There is also a |
| 15 | +second configuration option using RTI Cloud Discovery Service to use Unicast. |
| 16 | + |
| 17 | +## Environment variables |
| 18 | + |
| 19 | +For your convenience, there are 2 scripts to set up environment variables: |
| 20 | + |
| 21 | +- Linux: *variables.sh* |
| 22 | +- Windows: *variables.bat* |
| 23 | + |
| 24 | +These are the variables they contain, which you should modify according to your |
| 25 | +system: |
| 26 | + |
| 27 | +- **NDDSHOME**: path to the installation of RTI Connext Professional. |
| 28 | +- **NDDS_QOS_PROFILES**: path to the *qos.xml* file containing QoS profiles. |
| 29 | +- **SHMEM_DOMAIN**: the domain for the applications using SHMEM. |
| 30 | +- **UDP_DOMAIN**: the domain for the applications using UDP (mainly the |
| 31 | +DomainParticipant of RTI Routing Service). |
| 32 | +- **APPS**: total number of DomainParticipants on the localhost. By default, |
| 33 | +Connext will try to reach out to the first 5 created applications on SHMEM, |
| 34 | +therefore, we need to increase that number if there are more than 5 |
| 35 | +applications. |
| 36 | +- **CDS_IP_ADDRESS**: the IP address of the host that contains RTI Cloud |
| 37 | +Discovery Service. |
| 38 | +- **CDS_PORT**: the UDP port that CDS will use. |
| 39 | + |
| 40 | +On Linux, you can use the environment variables by sourcing the file: |
| 41 | + |
| 42 | +```bash |
| 43 | +source variables.sh |
| 44 | +``` |
| 45 | + |
| 46 | +On Windows, simply run it: |
| 47 | + |
| 48 | +```bash |
| 49 | +> variables.bat |
| 50 | +``` |
| 51 | + |
| 52 | +For convenience, the rest of the README will use the Linux variable sign ($) |
| 53 | +instead of the Windows variable signs (%%). |
| 54 | + |
| 55 | +## Multicast example |
| 56 | + |
| 57 | +You will need 3 terminals to run this example. |
| 58 | + |
| 59 | +1. On terminal 1, source the variables script and run an RTI DDS Ping |
| 60 | +publisher on SHMEM acting as a local publisher: |
| 61 | + |
| 62 | + ```bash |
| 63 | + source variables.sh |
| 64 | + $NDDSHOME/bin/rtiddsping -pub -domain $SHMEM_DOMAIN -qosProfile "example_library::shmem_profile" |
| 65 | + ``` |
| 66 | + |
| 67 | +2. On terminal 2, source the variables script and run an RTI DDS Ping |
| 68 | +subscriber on UDP acting as a remote subscriber: |
| 69 | + |
| 70 | + ```bash |
| 71 | + source variables.sh |
| 72 | + $NDDSHOME/bin/rtiddsping -sub -domain $UDP_DOMAIN -qosProfile "example_library::multicast" |
| 73 | + ``` |
| 74 | + |
| 75 | +3. At this point, there should be no communication between both applications. |
| 76 | +They are on different domains and they're using different transports. |
| 77 | +On terminal 3, on the same host as the SHMEM application, |
| 78 | +source the variables script and start Routing Service: |
| 79 | + |
| 80 | + ```bash |
| 81 | + source variables.sh |
| 82 | + $NDDSHOME/bin/rtiroutingservice -cfgFile RS_config_multicast.xml -cfgName gateway_SHMEM_and_UDP |
| 83 | + ``` |
| 84 | + |
| 85 | +4. The subscriber should now be receiving data. For instance: |
| 86 | + |
| 87 | + ```bash |
| 88 | + ... |
| 89 | + Current alive publisher tally is: 1 |
| 90 | + rtiddsping, issue received: 0000002 |
| 91 | + rtiddsping, issue received: 0000003 |
| 92 | + rtiddsping, issue received: 0000004 |
| 93 | + rtiddsping, issue received: 0000005 |
| 94 | + ... |
| 95 | + ``` |
| 96 | + |
| 97 | +5. (Optional) Feel free to explore the QoS and RS config files. The relevant |
| 98 | +QoS profiles for this example are *shmem_profile* and *multicast*. The RS file |
| 99 | +contains a *domain_route* with 2 DPs. 1 for UDP and another one for SHMEM |
| 100 | +(configured through the DP QoS). It also contains 2 *auto_topic_route* tags |
| 101 | +that allow the traffic to flow in the SHMEM --> UDP and SHMEM <-- UDP |
| 102 | +directions. In a real scenario, there would most likely be more topic routes, |
| 103 | +because different topics will require different DW / DR QoS policies. |
| 104 | + |
| 105 | +6. (Optional) You can run Wireshark and capture data to verify that the |
| 106 | +traffic only goes to the 3 different ports that Routing Service opens: |
| 107 | +Multicast discovery, Unicast discovery and Unicast user-data. Which ports are |
| 108 | +actually in use will depend on the domain ID you use for UDP and whether you |
| 109 | +started the RTI DDS Ping application on the same machine as Routing Service or |
| 110 | +not. Remember you can check the ports in use on this [spreadsheet](https://d2vkrkwbbxbylk.cloudfront.net/sites/default/files/knowledge_base/Port%20Assign4.2e.xls). |
| 111 | + |
| 112 | +6. You can now shutdown the 3 applications with Ctrl+C. |
| 113 | + |
| 114 | +## Multicast-less example (CDS) |
| 115 | + |
| 116 | +You will need 3 terminals to run this example. |
| 117 | + |
| 118 | +1. On terminal 1, source the variables script and run an RTI DDS Ping |
| 119 | +publisher on SHMEM acting as a local publisher: |
| 120 | + |
| 121 | + ```bash |
| 122 | + source variables.sh |
| 123 | + $NDDSHOME/bin/rtiddsping -pub -domain $SHMEM_DOMAIN -qosProfile "example_library::shmem_profile" |
| 124 | + ``` |
| 125 | + |
| 126 | +2. Install the CDS package. For instance: *rti_cloud_discovery_service-7.2.0-host-x64Linux.rtipkg* |
| 127 | + |
| 128 | +3. On terminal 2, source the variables script and start CDS: |
| 129 | + |
| 130 | + ```bash |
| 131 | + $NDDSHOME/bin/rticlouddiscoveryservice -cfgFile CDS_config.xml -cfgName cds_all_domains_udpv4 |
| 132 | + ``` |
| 133 | + |
| 134 | +4. On terminal 3, source the variables script and run an RTI DDS Ping |
| 135 | +subscriber on UDP acting as a remote subscriber: |
| 136 | + |
| 137 | + ```bash |
| 138 | + source variables.sh |
| 139 | + $NDDSHOME/bin/rtiddsping -sub -domain $UDP_DOMAIN -qosProfile "example_library::no_multicast" |
| 140 | + ``` |
| 141 | + |
| 142 | +5. At this point, there should be no communication between both applications. |
| 143 | +They are on different domains and they're using different transports. On |
| 144 | +terminal 4, on the same host as the SHMEM application, source the variables |
| 145 | +script and start Routing Service: |
| 146 | +
|
| 147 | + ```bash |
| 148 | + source variables.sh |
| 149 | + $NDDSHOME/bin/rtiroutingservice -cfgFile RS_config_with_CDS.xml -cfgName gateway_SHMEM_and_UDP |
| 150 | + ``` |
| 151 | +
|
| 152 | +6. The subscriber should now be receiving data. For instance: |
| 153 | +
|
| 154 | + ```bash |
| 155 | + ... |
| 156 | + Current alive publisher tally is: 1 |
| 157 | + rtiddsping, issue received: 0000002 |
| 158 | + rtiddsping, issue received: 0000003 |
| 159 | + rtiddsping, issue received: 0000004 |
| 160 | + rtiddsping, issue received: 0000005 |
| 161 | + ... |
| 162 | + ``` |
| 163 | +
|
| 164 | +7. (Optional) Feel free to explore the QoS and RS config files. The relevant |
| 165 | +QoS profiles for this example are *shmem_profile* and *no_multicast*. The RS |
| 166 | +file contains a *domain_route* with 2 DPs. 1 for UDP and another one for SHMEM |
| 167 | +(configured through the DP QoS). It also contains 2 *auto_topic_route* tags |
| 168 | +that allow the traffic to flow in the SHMEM --> UDP and SHMEM <-- UDP |
| 169 | +directions. In a real scenario, there would most likely be more topic routes, |
| 170 | +because different topics will require different DW / DR QoS policies. |
| 171 | +
|
| 172 | +8. (Optional) You can run Wireshark and capture data to verify that the |
| 173 | +traffic only goes to the 2 different ports that Routing Service opens: Unicast |
| 174 | +discovery and Unicast user-data. Which ports are actually in use will depend |
| 175 | +on the domain ID you use for UDP and whether you started the RTI DDS Ping |
| 176 | +application on the same machine as Routing Service or not. Remember you can |
| 177 | +check the ports in use on this [spreadsheet](https://d2vkrkwbbxbylk.cloudfront.net/sites/default/files/knowledge_base/Port%20Assign4.2e.xls). |
| 178 | +
|
| 179 | +8. You can now shutdown the 4 applications with Ctrl+C. |
0 commit comments