Ariticle

Introduction to the Refinitiv Real-Time Java Docker Image

Jirapongse Phuriphanvichai
Developer Advocate Developer Advocate

Last Updated: July 2021

The Refinitiv Real-Time SDK is a suite of modern and open source APIs that is designed to simplify development through a strong focus on ease of use and standardized access to a broad set of Refinitiv and proprietary content and services.

It currently supports C, C++, and Java programming languages and can be run on several operating systems including Windows, Oracle Linux, Red Hat Enterprise Linux, and CentOS.

Note: Although the Refinitiv Real-Time SDK can also run on Docker, it isn't officially qualified on the Docker platform. If you find any problems while running it on the Docker platform, the issues must be replicated on bare metal machines before contacting the helpdesk support.

This article demonstrates how to use the Refinitiv Real-Time SDK on the Docker platform. It has three sections including:

  • Refinitiv APIs docker images on the Docker Hub
  • Deploying the Refinitiv Real-Time SDK Java docker image
  • Running examples in the docker container

Refinitiv APIs docker images

The source of the Refinitiv Real-Time SDK is available in GitHub. The Refinitiv Real-Time SDK C/C++ and Java libraries can be built by using CMake and Gradle, respectively. Steps to build the Refinitiv Real-Time SDK libraries are mentioned in GitHub (C/C++, and Java). Moreover, you can create your own Refinitiv Real-Time SDK docker image by following steps in the Deploy and Run Refinitiv Real-Time SDK in Docker article.

Fortunately, the Refinitiv Real-Time SDK Docker images are now available in Docker Hub, as shown below.

  • refinitivapis/realtimesdk_c: This docker image contains the latest version of Refinitiv Real-Time SDK C/C++ libraries and examples. The image is rebuilt when the new version of Refinitiv Real-Time SDK is available in GitHub. It uses Oracle Linux 7 as a based image and the GCC version is 4.8.5.

  • refinitivapis/realtimesdk_java: This docker image contains the latest version of Refinitiv Real-Time SDK Java libraries and examples. The image is rebuilt when the new version of Refinitiv Real-Time SDK is available in GitHub. It uses Oracle Linux 7 as a based image and the Oracle OpenJDK version is 11.

  • refinitivapis/websocket_api: This docker image contains WebSocket API Examples used to connect to Refinitiv Real-Time Distribution System or Refinitiv Data Platform to consume real-time data through the WebSocket connections. There are examples of various programming languages such as CSharp, Java, Python, Go, Ruby, Node, Perl, and R. The examples are available in GitHub. The image uses Oracle Linux 8 as a base image and it installs Python 3.9 used to run Python WebSocket API examples.

This article only focuses on the refinitivapis/realtimesdk_java docker image.

In the next section, I will demonstrate how to deploy the refinitivapis/realtimesdk_java image on Docker engines and Azure Containers.

Deploying the Refinitiv Real-Time SDK Java docker image

The docker images can be run as docker containers on local machines or cloud platforms. To follow steps in this section, the docker engine must be installed on a local machine or an Azure account is ready to be used.

Deploying the Refinitiv Real-Time SDK Java docker image on a local machine

First, the docker engine must be installed and run properly on the machine. The "docker version" command can be used to verify the docker engine.

    	
            

# docker version

Client: Docker Engine - Community

 Version:           19.03.1-ol

 API version:       1.40

 Go version:        go1.12.5

 Git commit:        ead9442

 Built:             Wed Sep 11 06:40:28 2019

 OS/Arch:           linux/amd64

 Experimental:      false

 

Server: Docker Engine - Community

 Engine:

  Version:          19.03.1-ol

  API version:      1.40 (minimum version 1.12)

  Go version:       go1.12.5

  Git commit:       ead9442

  Built:            Wed Sep 11 06:38:43 2019

  OS/Arch:          linux/amd64

  Experimental:     false

  Default Registry: docker.io

 containerd:

  Version:          v1.2.0-rc.0-108-gc444666

  GitCommit:        c4446665cb9c30056f4998ed953e6d4ff22c7c39

 runc:

  Version:          1.0.0-rc5+dev

  GitCommit:        4bb1fe4ace1a32d3676bb98f5d3b6a4e32bf6c58

 docker-init:

  Version:          0.18.0

  GitCommit:        fec3683

When the docker engine is started, the "docker pull refinitivapis/realtimesdk_java" command can be used to download the latest Refinitiv Real-Time SDK Java docker image from the Docker Hub.

    	
            

# docker pull refinitivapis/realtimesdk_java

Using default tag: latest

Trying to pull repository docker.io/refinitivapis/realtimesdk_java ...

latest: Pulling from docker.io/refinitivapis/realtimesdk_java

01eb3c96478b: Already exists

de98b59498ca: Pull complete

Digest: sha256:bd68e2302828dbfb7a6f5f62a76baad14c3bad6bd7ec21d3ee30d8de3c315e4e

Status: Downloaded newer image for refinitivapis/realtimesdk_java:latest

refinitivapis/realtimesdk_java:latest

After downloading, the "docker images" command can be used to verify that the Refinitiv Real-Time SDK Java docker image is available on the machine.

    	
            

# docker images

REPOSITORY                    TAG                 IMAGE ID            CREATED             SIZE

refinitivapis/realtimesdk_java   latest              7f5e78fd2b65        3 hours ago         1.84GB

The output of the "docker images" command must contain the refinitivapis/realtimesdk_java repository.

A Docker image can be run inside a container. The "docker run" command creates a new running container instance of the docker image. The following command can be used to run a container instance of the Refinitiv Real-Time SDK Java docker image.

    	
            

# docker run -it --name realtimejava  refinitivapis/realtimesdk_java

sh-4.2# ls

CHANGELOG.md  README.md                          etc      gradlew.bat

Ema           RTSDK-Java-Edition_Test_Plan.xlsx  gradle   settings.gradle

Eta           build.gradle                       gradlew

sh-4.2# pwd

/opt/refinitiv/Real-Time-SDK/Java

After running this command, you can access shell in the container. Then, you run the Refinitiv Real-Time SDK examples in the container. The Refinitiv Real-Time SDK Java is in /opt/refinitiv/Real-Time-SDK/Java directory.

Deploying the Refinitiv SDK Java docker image on Azure

Instead of running docker containers on the local machine, you can run the Refinitiv Real-Time SDK Java docker container on Azure Container Instances. Azure Container Instances are used to create and manage Docker containers in Azure without having to set up virtual machines or manage additional infrastructure.

First, log in to Azure and then create a new Container Instances resource.

On the Create container instance page, fill in all required information. Select Docker Hub or other registry for the Image source and enter refinitivapis/realtimesdk_java for the Image. Then, click on the Next: Networking button.

On the Networking tab, keep the default setting. Then click on the Next: Advanced button.

On the Advanced tab, enter [ "/bin/bash", "-c", "echo hello; sleep 60m" ] for the Command override. This command will keep the container running for 60 minutes before exiting. You can use another command or change the sleep time to keep the container running. Then, click on Review + create button.

Next, review the information and then click on the Create button to create a container instance.

Wait for the deployment process to be completed. After the deployment is complete, click on the created resource (realtimesdkjava).

On the overview page, verify that the status of the container is Running.

Then, select Containers under Settings, click on the Connect tab, choose the shell to be used, and then click on the Connect button.

Now, you can access shell in the container.

Running examples in the container

This section demonstrates how to run EMA and ETA examples in the container to consume real-time data from Refinitiv Real-Time - Optimized. The Refinitiv Real-Time SDK Java is in the /opt/refinitiv/Real-Time-SDK/Java.

To connect to Refinitiv Real-Time - Optimized, the following information is required.

  1. UserID/MachineID
  2. Password
  3. AppKey (Client ID)

For more information, please refer to the Getting Start with Refinitiv Data Platform article.

Running an EMA example

In the Refinitiv Real-Time SDK package, ex113_MP_SessionMgmt is an OMM Consumer application example that demonstrates the basic usage of the EMA library in accessing and parsing OMM MarketPrice data from Refinitiv Real-Time - Optimized. The source code files and the working directory of this example are available in the following directories:

  • Source code files: /opt/refinitiv/Real-Time-SDK/Java/Ema/Examples/src/main/java/com/refinitiv/ema/examples/training/consumer/series100/ex113_MP_SessionMgmt
  • Working directory: /opt/refinitiv/Real-Time-SDK/Java/Ema/Examples

Follow these steps to run the ex113_MP_SessionMgmt example:

1. Change the current directory to /opt/refinitiv/Real-Time-SDK/Java

sh-4.2# cd /opt/refinitiv/Real-Time-SDK/Java

2. (Optional) Download a Java key store file containing certificates to connect to Refinitiv Real-Time – Optimized

sh-4.2# wget https://github.com/jirapongse-refinitiv/dockerbuild/raw/master/keystore.jks

You can create your own key store file by following the steps mentioned in the Building a keystore file to be used with an HTTPS (or ENCRYPTED) connection type for real-time Java-based API article.

3.  (Optional) Copy the key store file (keystore.jks) to the working directory (/opt/refinitiv/Real-Time-SDK/Java/Ema/Examples).

sh-4.2# cp keystore.jks Ema/Examples

4. Run the ex113_MP_SessionMgmt example with the following command. The keyfile and keypasswd parameters are optional.

sh-4.2# ./gradlew runConsumer113 -PcommandLineArgs="-username <UserID or MachineID>  -password <Password> -clientId <AppKey> -keyfile keystore.jks -keypasswd refinitiv -itemName JPY="

Sep 22, 2020 9:24:59 AM com.refinitiv.ema.access.ChannelCallbackClient reactorChannelEventCallback

INFO: loggerMsg

    ClientName: ChannelCallbackClient

    Severity: Info

    Text:    Received ChannelUp event on channel Channel_4

        Instance Name Consumer_4_1

        Component Version ads3.2.1.L1.linux.tis.rrg 64-bit

loggerMsgEnd

RefreshMsg

    streamId="5"

    domain="MarketPrice Domain"

    solicited

    RefreshComplete

    state="Open / Ok / None / '*All is well'"

    itemGroup="00 ca"

    permissionData="03 01 01 52 6c"

    name="JPY="

    nameType="1"

    serviceId="257"

    serviceName="ELEKTRON_DD"

    Payload dataType="FieldList"

        FieldList FieldListNum="99" DictionaryId="1"

            FieldEntry fid="1" name="PROD_PERM" dataType="UInt" value="526"

            FieldEntry fid="2" name="RDNDISPLAY" dataType="UInt" value="153"

            FieldEntry fid="3" name="DSPLY_NAME" dataType="Rmtes" value="SEB          STO"

            FieldEntry fid="5" name="TIMACT" dataType="Time" value="09:25:00:000:000:000"

            FieldEntry fid="11" name="NETCHNG_1" dataType="Real" value="-0.07"

            FieldEntry fid="12" name="HIGH_1" dataType="Real" value="104.75"

            FieldEntry fid="13" name="LOW_1" dataType="Real" value="104.47"

            FieldEntry fid="15" name="CURRENCY" dataType="Enum" value="392"

            FieldEntry fid="17" name="ACTIV_DATE" dataType="Date" value="22 SEP 2020"

            FieldEntry fid="19" name="OPEN_PRC" dataType="Real" value="104.63"

            FieldEntry fid="21" name="HST_CLOSE" dataType="Real" value="104.64"

            FieldEntry fid="22" name="BID" dataType="Real" value="104.57"

If you are using your own key store file, please change values of the keyfile and keypasswd parameters.

The example will connect to Refinitiv Real-Time – Optimized and subscribe to JPY= from the ELEKTRON_DD service.

Running an ETA example

VAConsumer is an ETA example that uses the ValueAdd component to consume data from an OMM Provider, ADS device, OMM Provider application, or Refinitiv Real-Time – Optimized. The source code files and the working directory of this example are available in the following directories:

  • Source code files: /opt/refinitiv/Real-Time-SDK/Java/ Eta/Applications/Examples/src/main/java/com/refinitiv/upa/valueadd/examples/consumer
  • Working directory: /opt/refinitiv/Real-Time-SDK/Java/Eta/Applications/Examples

Follow these steps to run the VAConsumer example:

1. Change the current directory to /opt/refinitiv/Real-Time-SDK/Java

sh-4.2# cd /opt/refinitiv/Real-Time-SDK/Java

2. (Optional) Download a Java key store file containing certificates to connect to Refinitiv Real-Time – Optimized

sh-4.2# wget https://github.com/jirapongse-refinitiv/dockerbuild/raw/master/keystore.jks

3. (Optional) Copy the key store file (keystore.jks) to the working directory (/opt/refinitiv/Real-Time-SDK/Java/Eta/Applications/Examples)

sh-4.2# cp keystore.jks Eta/Applications/Examples

4. Run the VAConsumer example with the following parameters. The keyfile and keypasswd parameters are optional.

sh-4.2# ./gradlew runVAConsumer -PcommandLineArgs="-uname <UserID or MachineID> -passwd <Password> -clientId <AppKey> -keyfile keystore.jks -keypasswd refinitiv -connectionType encrypted -c ap-southeast-1-aws-3-med.optimized-pricing-api.refinitiv.net:14002 ELEKTRON_DD mp:JPY= -sessionMgnt"

 

Channel Up Event: java.nio.channels.SocketChannel[connected local=/10.244.85.5:52582 remote=apac-1-t2.streaming-pricing-api.refinitiv.com/34.233.36.26:14002]

Received Login Refresh for Username: xxx

LoginRefresh:

        streamId: 1

        name: xxx

        nameType: 1

        State: Open/Ok/None - text: "Login accepted by host ads-premium-az1-blue-15-main-prd.use1-az1."

        isSolicited: true

        authenticationTTReissue: 1600765553

        authenticationErrorCode: 0

        authenticationErrorText:

        applicationId: 256

        applicationName: ADS

        position: 10.244.85.5/wk-caas-ee59fab9ab2c41cd91778748483b3802-02c854215e90d5ff0af9bf

        providePermissionProfile: 0

        providePermissionExpressions: 1

        singleOpen: 1

        allowSuspectData: 1

        supportBatchRequests: 1

        supportBatchReissues: 1

        supportBatchCloses: 1

        supportOMMPost: 1

        supportOptimizedPauseResume: 0

        supportStandby: 0

        supportViewRequests: 1...

Received serviceName: ELEKTRON_DD

 

Channel Ready Event: java.nio.channels.SocketChannel[connected local=/10.244.85.5:52582 remote=apac-1-t2.streaming-pricing-api.refinitiv.com/34.233.36.26:14002]

MarketPriceRequest:

        streamId: 5

        streaming: true

        domain: MARKET_PRICE

        isPrivateStream: false

        hasView: false

        itemNames: [JPY=]

        serviceId: 257

        priority class: 1, priority count: 1

        qos: Qos: Realtime/JustInTimeConflated/Static - timeInfo: 0 - rateInfo: 0

 

(Channel java.nio.channels.SocketChannel[connected local=/10.244.85.5:52582 remote=apac-1-t2.streaming-pricing-api.refinitiv.com/3

4.233.36.26:14002]):

JPY=

DOMAIN: MARKET_PRICE

State: Open/Ok/None - text: "*All is well"

        1/PROD_PERM: 526

        2/RDNDISPLAY: 153

        3/DSPLY_NAME: NEDBANK LTD  JHB

        5/TIMACT: 09:00:00:000:000:000

If you are using your own key store file, please change the values of the keyfile and keypasswd parameters.

The example will connect to Refinitiv Real-Time – Optimized and subscribe to JPY= from the ELEKTRON_DD service.

Summary

This article introduces Refinitiv Real-Time SDK and WebSocket API Docker images in Docker Hub. The refinitivapis/realtimesdk_c docker image contains the latest version of Refinitiv Real-Time C/C++ libraries and examples. The refinitivapis/realtimesdk_java docker image contains the latest version of Refinitiv Real-Time SDK Java libraries and examples. The refinitivapis/websocket_api docker image contains WebSocket API Examples used to connect to Refinitiv Real-Time Distribution System or Refinitiv Data Platform to consume real-time data through the WebSocket connections. Then, it demonstrates how to deploy the refinitivapis/realtimesdk_java docker image on the Docker engines and Azure Containers. Finally, it shows how to run examples to retrieve real-time data from Refinitiv Real-Time – Optimized.

References

  1. Azure.microsoft.com. 2020. Azure Container Instances | Microsoft Azure. [online] Available at: https://azure.microsoft.com/en-us/services/container-instances/ [Accessed 15 July 2020].
  2. Azure.microsoft.com. 2020. Cloud Computing Services | Microsoft Azure. [online] Available at: https://azure.microsoft.com/en-us/ [Accessed 15 July 2020].
  3. Cmake.org. n.d. Cmake. [online] Available at: https://cmake.org/ [Accessed 15 July 2020].
  4. Hub.docker.com. n.d. Docker Image For Refinitiv Real-Time SDK C/CPP. [online] Available at: https://hub.docker.com/repository/docker/refinitivapis/realtimesdk_c [Accessed 22 Sep 2020].
  5. Hub.docker.com. 2020. Docker Image For Refinitiv Real-Time SDK Java. [online] Available at: https://hub.docker.com/r/refinitivapis/realtimesdk_java [Accessed 22 Sep 2020].
  6. Hub.docker.com. 2020. Docker Image For Websocket APIs. [online] Available at: https://hub.docker.com/r/refinitivapis/websocket_api [Accessed 15 July 2020].
  7. Docker Documentation. 2020. Get Docker. [online] Available at: https://docs.docker.com/get-docker/ [Accessed 15 July 2020].
  8. Gradle. 2020. Gradle Build Tool. [online] Available at: https://gradle.org [Accessed 15 July 2020].
  9. Phuriphanvichai, J., 2017. Deploy And Run Refinitiv Real-Time SDK In Docker | DEVELOPER COMMUNITY. [online] Developers.refinitiv.com. Available at: https://developers.refinitiv.com/en/article-catalog/article/deploy-and-run-elektron-sdk-docker [Accessed 15 July 2020].
  10. GitHub. n.d. Refinitiv/Real-Time-SDK. [online] Available at: https://github.com/Refinitiv/Real-Time-SDK [Accessed 15 July 2020].
  11. GitHub. n.d. Refinitiv/Websocket-Api. [online] Available at: https://github.com/Refinitiv/websocket-api/ [Accessed 15 July 2020].
  12. Rungruengrayubkul, V., 2020. Getting Start With Refinitiv Data Platform | DEVELOPER COMMUNITY. [online] Developers.refinitiv.com. Available at: https://developers.refinitiv.com/en/article-catalog/article/getting-start-with-refinitiv-data-platform [Accessed 15 July 2020].
  13. Kunvutipongsak, N., 2018. Building A Keystore File To Be Used With An HTTPS (Or ENCRYPTED) Connection Type For Real-Time Java-Based Apis | DEVELOPER COMMUNITY. [online] Developers.refinitiv.com. Available at: <https://developers.refinitiv.com/en/article-catalog/article/building-keystore-file-be-used-https-or-encrypted-connection-type-real-time-java-based-apis> [Accessed 22 September 2020].