question

Upvotes
Accepted
27 8 13 13

LoginStream Closed

Hi

I am following example450 ( Java API EMA) and running my code from eclipse. I am getting error of "Login stream was closed". How do I make the token refresh? And how do I know when the current token is going to expire? I tried using OperationModel.API_DISPATCH in EmaFactory.createOmmConsumer method call. But of no use. Can anybody help me with the example code or some solution code on this? so that I keep getting the data uninterrupted.

Thanks, Dhruv



elektronrefinitiv-realtimeelektron-sdkema-apirrtelektron-message-apierror-login
loginstreamclosed.png (152.5 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvote
Accepted
32.2k 40 11 20

Hello @dhruv.arora,

Try replacing

Thread.sleep(900000);

With

while(true)
     Thread.sleep(1000);

Is this what you are looking for?

The examples in EMA examples collection are designed to demo one feature of EMA API by running it for a limited interval of time, and then to exit.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
9.6k 10 7 7

Hello @dhruv.arora

Token refresh is made automatically by ESDK API which is EMA and ETA(underlying API of EMA). Hence, you do nothing to handle this. As shown in the figure below:

For more details, please refer to 6.3 Authentication Token Management in EMA Java Developers Guide . If there is any token problem, you should see the error on the console.

I have tested example450 when it exited after 900000 milliseconds or about 15 minutes, EMA consumer.uninitialize() was called as shown in the source code below:

Thread.sleep(900000);// API calls onRefreshMsg(), onUpdateMsg() and onStatusMsg()
} 
catch (InterruptedException | OmmException excp)
{
    System.out.println(excp.getMessage());
}
finally 
{
    if (consumer != null) consumer.uninitialize();
    if (serviceDiscovery != null) serviceDiscovery.uninitialize();
}

This method made EMA closed login stream and the messages which were the same as you found were shown:

It was possible that login stream was closed because consumer.uninitialize() was called after Thread.sleep(...). To prove this, you may add a message to be printed after Thread.sleep(...) like example source code below:

Thread.sleep(900000); 
System.out.println("Exit after Sleep");

Hope this help.


loginreissue.png (52.8 KiB)
exitaftersleep.png (36.7 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
9.6k 10 7 7

Hello @dhruv.arora

example450 will run around 900000 milliseconds about 15 minutes according to Thread.sleep(900000). Then, the application calls consumer.uninitialize() to logout from the server this make "Login stream was closed" are shown. This is normal behavior of the example. You can extend the runtime in Thread.sleep(900000) e.g. Thread.sleep(990000)

Anyway, "Login stream was closed" can be shown when a problem occurs as well. That's why I suggest you to add a message to be printed after Thread.sleep(...) to prove the application works normally(after sleep time reaches then application exits) or not.

After you start the application, when the messages above are shown? If it is around the time in Thread.sleep(..). For example, Thread.sleep(900000): after around 15 minutes you start the application, the messages are shown so the application works normally. If the messages are shown before 15 minutes e.g. 5 minutes after start, there is something wrong which makes the login stream is closed.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
24.7k 54 17 14

Hello @dhruv.arora

The ERT in Cloud credentials are access_token and refresh_token.

  • The access_token is the one that use for connecting to the Elektron server
  • The refresh_token is the token that use for re-new access_token

By default, the access_token validity time is 300 seconds (5 minutes).

As mention by my colleague, the ESDK API automatic handles the above credentials (login, re-new, etc) and session for the application. The application does not need to manual operation ERT in Cloud credentials/session. The API automatics re-new session for the application until the application stop (reach runtime period as defined in Thread.sleep(900000) etc).

You can find more resources regarding the ERT in Cloud logic in the following links:

The above documents refer to the Elektron WebSocket API but the ERT in Cloud logic are the same as ESDK (and ESDK also automatic handles most of the operation for developers).

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
27 8 13 13

Hi @Wasin Waeosri & Pimchaya.Wongrukun


Thanks for the explanation. My scenario is -- my java code would keep fetching the market price data and push it to AWS Kinesis Stream on a continuous basis, without java code to finish after 15 minutes. ? I ran the example with 15 minutes and it ran as expected as suggested by Pimchaya and the result is attached here.

How can I make the code always keep running and outputting the market price data without the restriction of 15 minutes? I would appreciate if you can share some code to do this.

15MinutesRun.txt

Thanks & Regards,

Dhruv


15minutesrun.txt (38.2 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Upvotes
27 8 13 13

Hi zoya.farberov

Thanks for your solution. It worked, but in between it keeps giving the error message of Error text Failed REST request from HTTP status code 400 for user: GE-A-01444311-3-2480. Text: {"error_description":"iPlanet session has been expired.","error":"access_denied"} in-between update messages.

Please see attached text file, for example, the error came at Jul 20, 2020 11:19:08 AM and it continued till Jul 20, 2020 11:35:33 AM, before it gave another update message. Is it normal? or anything can be done about it for more smooth sailing?

Thanks a lot

Dhruv

ThreadLoop.txt


threadloop.txt (52.7 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello @dhruv.arora,

Are you on the latest ESDK 1.5? This is what I would check first, as some issues around refresh have been fixed in later version, and it's always good to make sure you have the latest.

If on the latest, the second thing I would verify is if this is the only instance running. Stop this instance and all the instances, and test with a single instance running, to see if you continue getting IPlanet error.

Hi @zoya.farberov , I am using Elektron-SDK-1.5.0.L1.java and running a single instance only.

Hi @dhruv.arora

Please confirm that you use the example unmodified, exactly as is except for the exit code?

I have restarted and tested this example 3 times, and so far I am not reproducing the error that you see.

If you restart, the example, how soon do you start seeing this error? Is it consistent? For how long do you see it?

Show more comments
Upvotes
24.7k 54 17 14

Hello @dhruv.arora

Basically, the "iPlanet session has been expired." error can be occurred when the refresh token is expired (18 hours).

Since this issue seems to happen in your environment randomly, it may need to investigate on the server side to verify the issue. You can open a support ticket to ERT in Cloud server team on the https://my.refinitiv.com/ site. Given this will likely require troubleshooting on the server side, you will likely need to provide your Machine ID as part of your question. To open a ticket, click on the above link and do the following:

  1. Click the "Get Support" button on the top right.
  2. Select "Product and Content" and then click "I need help using the product".
  3. From the Product drop list, choose: "Elektron Real Time in Cloud".
  4. Provide your details - reference this question as well.
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.