Springboot REST API using EMA

quotes-support
quotes-support Newcomer
edited May 26 in EMA

was looking for examples of how to develop a springboot REST API using the EMA API. Any good references ? using the following version

implementation("com.refinitiv.ema:ema:3.8.3.0")

Answers

  • wasin.w
    wasin.w admin

    Hello @quotes-support

    There is an article How to build a scalable web service for stock prices that uses EMA API + deployed RTDS + Springboot to create REST API application. The example source code link is available on the article page.

    The example of the same Springboot app that has been modified to consume data from RTO is available on GitHub https://github.com/LSEG-API-Samples/Article.EMA.Java.RTO.Azure repo.

  • thank you for responding. You mentioned RTO, will this example also work for RTMDS ?

  • wasin.w
    wasin.w admin
    edited May 28

    Hello @quotes-support

    If you are using RTMDS, please see the deployed RTDS version on this https://developers.lseg.com/en/article-catalog/article/scalable-web-service-for-stock article (the GitHub link is available on the article).

    The RTMDS is basically the RTDS components deployed on LSEG hosted infra, so the connection and code are the same as the deployed RTDS (you need Server IP Address, RSSL Port, DACS Username, Service name).

    The RTO is RTDS hosted on AWS cloud. It requires different credential and connection code than the RTMDS/RTDS.

  • Getting login exception. Have provided the correct information for our RTMDS . Please help.

    [WARN]~2025-06-07-14.44.11.532CDT~~~~~~ o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext Exception encountered during context initialization - cancelling refresh attempt: Exception Type='OmmInvalidUsageException', Text='login failed (timed out after waiting 45000 milliseconds) for ip.of.our.RTMDS.SERVER:14002)', Error Code='-4052'
    [INFO]~2025-06-07-14.44.11.548CDT~~~~~~ o.a.c.h.Http11NioProtocol Stopping ProtocolHandler ["http-nio-8080"]
    [INFO]~2025-06-07-14.44.12.325CDT~~~~~~ o.a.c.c.StandardService Stopping service [Tomcat]
    [WARN]~2025-06-07-14.44.12.334CDT~~~~~~ o.a.c.l.WebappClassLoaderBase The web application [ROOT] appears to have started a thread named [idle-connection-evictor-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
    java.base@17 .0.12/java.lang.Thread.sleep(Native Method)
    java.base@17 .0.12/java.lang.Thread.sleep(Thread.java:346)
    java.base@17 .0.12/java.util.concurrent.TimeUnit.sleep(TimeUnit.java:446)
    app//org.apache.hc.core5.util.TimeValue.sleep(TimeValue.java:383)
    app//org.apache.hc.client5.http.impl.IdleConnectionEvictor.lambda$new$0(IdleConnectionEvictor.java:60)
    app//org.apache.hc.client5.http.impl.IdleConnectionEvictor$$Lambda$1228/0x0000021a0171a210.run(Unknown Source)
    java.base@17 .0.12/java.lang.Thread.run(Thread.java:842)
    [INFO]~2025-06-07-14.44.12.340CDT~~~~~~ o.s.b.a.l.ConditionEvaluationReportLogger

    Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled.
    [ERROR]~2025-06-07-14.44.12.370CDT~~~~~~ o.s.b.SpringApplication Application run failed com.refinitiv.ema.access.OmmInvalidUsageExceptionImpl: login failed (timed out after waiting 45000 milliseconds) for 146.242.129.66:14002)
    at com.refinitiv.ema.access.OmmBaseImpl.ommIUExcept(OmmBaseImpl.java:2099)
    at com.refinitiv.ema.access.OmmBaseImpl.handleLoginReqTimeout(OmmBaseImpl.java:1886)
    at com.refinitiv.ema.access.OmmConsumerImpl.handleAdminDomains(OmmConsumerImpl.java:679)
    at com.refinitiv.ema.access.OmmBaseImpl.initialize(OmmBaseImpl.java:368)

  • Is there anyway to get in touch with the author of the article - Gurpreet Bal ?

  • Also what kind of response times can we expect from the getQuote endpoint with the example shown here - https://community.developers.refinitiv.com/home/leaving?allowTrusted=1&target=https%3A%2F%2Fdevelopers.lseg.com%2Fen%2Farticle-catalog%2Farticle%2Fscalable-web-service-for-stock

  • wasin.w
    wasin.w admin

    Hello @quotes-support

    I found the log message.

    login failed (timed out after waiting 45000 milliseconds) for ip.of.our.RTMDS.SERVER:14002)', Error Code='-4052
    

    This log means the API did send a Login request message to RTMDS but it did not get any login response message back on time until it reaches timeout (45 seconds). This is most likely a network issue between your machine and RTMDS.

    • Can you telnet or ping to that RTMDS from the same application machine?
    • Can you replicate the issue with the ex100_MP_Streaming example connect to the same RTMDS?

    You may try to increase value of the LoginRequestTimeOut parameter on the EmaConfig.xml file.

    login_timeout.png

    If increasing the LoginRequestTimeOut parameter does not help, or you cannot telnet/ping to that RTMDS, or you encounter the same login timeout problem with the ex100_MP_Streaming example, I strongly suggest you contact the RTMDS support team.

    You can contact the team via https://support.lseg.com/ website.

    contact_rtmds_support.png

    About the getQuote endpoint question, that getQuote is an application created HTTP service which is based on how fast the EMA receives data from the server. You might need to contact the RTMDS team about their response time.