Author:
Real-Time Optimized (RTO) is Refinitiv conflated real-time content, hosted in the public cloud. It provides fast and simple access to our unparalleled content from hundreds of exchanges and OTC markets around the world. We can use WebSocket APIs or Real-Time SDKs to connect to Real-Time Optimized to consume real-time content. Real-Time Optimized is maintained by Refinitiv so we don’t have control over it. It means we are unable to shut down the services to test how applications handle unexpected behaviors originated by Real-Time Optimized or Refinitiv Data Platform services.
This article introduces the Refinitiv Real-Time Optimized Simulator Docker Image and demonstrates how to use it to test Refinitiv Real-Time Optimized consumer applications. To follow the steps mentioned in this article, Docker must be installed properly on the machine. Please refer to the Docker website regarding how to install Docker on your machine.
Note: This simulated environment is for development and testing purposes only.
Refinitiv Real-Time Optimized Simulator Docker Image
The Refinitiv Real-Time Optimized Simulator Docker image is available in Docker Hub (https://hub.docker.com/r/refinitivapis/rtosim).
It contains several services for simulating Refinitiv Real-Time Optimized including:
1. Certificate files
The certificate files include a private key file (key.pem) and public key files (cert.pem and cert.der). The certificate information is:
Common Name: www.test.com
Valid From: September 30, 2022
Valid To: September 27, 2032
Serial Number: fbb741b3b18d470a
2. HTTPS REST services for authentication and service discovery
The docker image contains a Node.js application that uses the Express framework to simulate the following Refinitiv Data Platform REST services.
Service | Endpoint | TCP Port |
---|---|---|
RDP Authentication Service V1 | /auth/oauth2/v1/token | 443 |
RDP Authentication Service V2 | /auth/oauth2/v2/token | 443 |
Service Discovery | /streaming/pricing/v1/ | 443 |
- RDP Authentication Service V1: This endpoint is used to get and renew tokens from Refinitiv Data Platform Authentication Service Version 1. The retrieved tokens will be used to access other RDP services.
- RDP Authentication Service V2: This endpoint is used to get and renew tokens from Refinitiv Data Platform Authentication Service Version 2. The retrieved tokens will be used to access other RDP services.
- Streaming Service Endpoint Information: This endpoint is used to get available streaming servers. The Refinitiv Real-Time SDK consumer applications will connect to one of these streaming servers to retrieve conflated real-time content.
3. RSSL interactive providers
The docker image contains three RSSL interactive providers used to test consumer applications in the following scenarios.
- Provider: This is an unmodified ETA provider example. It can be used to test the connection, subscriptions, and data retrieval.
- Provider_Login_Closed: This example is modified to send the login closed status message after sending 100 update messages. It can be used to test if applications can handle the login closed status message sent from the server.
- Provider_Login_Closed_Recovery: This example is modified to send the login closed recovery status message after sending 100 update messages. It can be used to test if applications can handle the login closed recovery status message sent from the server.
The following command can be used to download the Refinitiv Real-Time Optimized Simulator Docker Image from Docker Hub.
docker pull refinitivapis/rtosim
Running the simulated Refinitiv Real-Time Optimized in a Docker container.
This section demonstrates how to run the simulated Refinitiv Real-Time Optimized in a Docker container so users can run consumers to connect to RDP and Real-Time services running in the container.
1. Run the Refinitiv Real-Time Optimized Simulator Docker Image
The following command can be used to run the Refinitiv Real-Time Optimized Simulator Docker Image in a new Docker container.
docker run -it --name rtosim -h www.test.com -p 14002:14002 -p 443:443 refinitivapis/rtosim
The following options are used to run the image.
Option | Description |
---|---|
-i | Keep STDIN open even if not attached |
-t | Allocate a pseudo-TTY |
--name | Assign a name to the container (rtosim) |
-h | Container host name (www.test.com) |
-p | Publish a container's port(s) to the host (443 and 14002) |
In short, this command runs a new container of the refinitivapis/rtosim image, assigns the container’s name to rtosim, sets the hostname of the container to www.test.com, maps the TCP 443 and 14002 ports to the host machine, and allows users to access a shell in the container.
2. Start the Node.js application to simulate the RDP services
In the container’s shell, change the directory to the /opt/rdpservices directory.
cd /opt/rdpservices/
Then, run the app.js in the background. The application will use a private key file (key.pem) and a certificate file (cert.pem) from the /opt/cert/ directory.
node app.js &
Now, the simulated RDP services are running at the TCP 443 port.
3. Start the interactive provider to simulate Real-Time data feed
In the container’s shell, change the directory to the /opt/rdpservices directory.
cd /opt/providers
The application will use a private key file (key.pem) and a certificate file (cert.pem) from the /opt/cert/ directory. Run one of the following Provider examples in the background to start an interactive provider.
Command | Description |
---|---|
./Provider.sh | An unmodified ETA Provider example |
./Provider_Login_Closed.sh | A modified example to publish login closed status message |
./Provider_Login_Closed_Recovery.sh | A modified example to publish login closed recovery status message |
At this point, an interactive provider is running at the TCP 14002 port and the Real-Time service name is ELEKTRON_DD.
4. Run the EMA consumer applications
To connect to the services in the Docker container, the certificate file is required. The certificate file (cert.pem) is available in the /opt/cert/ directory in the container. Open a new terminal and run the following command to copy the cert.pem file to the current directory of the host machine.
docker cp rtosim:/opt/cert/cert.pem .
rtosim is the container’s name. Then, the certificate file (cert.pem) can be used in consumer applications to connect to the container.
Please refer to the Run EMA Examples section in the Setup a Simulated Real-Time Optimized Environment in 3 Steps article that demonstrates how to configure and run EMA C++ and Java examples on a Windows machine to connect to the simulated Real-Time Optimized environment running on the same machine.
5. Cleanup
Use the “exit” command in the container’s shell to exit the container. The container will be in the Exited state.
The container can be restarted by using the docker start command.
docker start -ai rtosim
Otherwise, the container can be removed by using the docker rm command.
docker rm rtosim
rtosim is the container’s name.
Summary
This article introduces the Refinitiv Real-Time Optimized Simulator Docker Image (refinitivapis/rtosim) and demonstrates how to run it in a new docker container. The Docker image contains certificate files, interactive provider examples, and a Node.js application used to simulate RDP and Refinitiv Real-Time services. Users can create a new container from the docker image and then access the container’s shell to start the Node.js application and Provider example. Then, consumer applications can use the certificate file (cert.pem) available in the container to connect to the simulated services.
References
- Accelerated, containerized application development (2023) Docker. Available at: http://www.docker.com/ (Accessed: January 31, 2023).
- Phuriphanvichai, J. (2022) Setup a simulated real-time optimized environment in 3 steps, Setup a Simulated Real-Time Optimized Environment in 3 Steps | Devportal. Refinitiv. Available at: https://developers.refinitiv.com/en/article-catalog/article/setup-a-simulated-real-time-optimized-environment-in-3-steps (Accessed: March 2, 2023).
- Real-Time – Optimized (no date) Refinitiv. Refinitiv. Available at: https://www.refinitiv.com/en/market-data/data-management/real-time-optimized (Accessed: January 31, 2023).
- Refinitiv Data Platform APIs (no date) Refinitiv Data Platform APIs | Devportal. Refinitiv. Available at: https://developers.refinitiv.com/en/api-catalog/refinitiv-data-platform/refinitiv-data-platform-apis (Accessed: March 2, 2023).
- Refinitiv Real-Time C++ SDK (no date) Refinitiv Real-Time C++ SDK | Devportal. Refinitiv. Available at: https://developers.refinitiv.com/en/api-catalog/refinitiv-real-time-opnsrc/rt-sdk-cc (Accessed: January 31, 2023).
- Refinitiv Real-Time Java SDK (no date) Refinitiv Real-Time Java SDK | Devportal. Refinitiv. Available at: https://developers.refinitiv.com/en/api-catalog/refinitiv-real-time-opnsrc/rt-sdk-java (Accessed: January 31, 2023).