question

Upvotes
Accepted
28 8 0 5

Data Streaming - Auto logout ("Login stream was closed.")

Hi,

I am trying to streaming data via EMA. However, I got "Login stream was closed." warning message after receiving several messages. May I know how can I keep connected and keep streaming data.

Thanks.

Regards,

Jun

elektronrefinitiv-realtimeelektron-sdkema-apirrtelektron-message-apilog-out
capture.png (33.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.

Upvotes
Accepted
22.8k 60 14 21

@hujunhu EMA has two event dispatch mechanism - one where the user thread is responsible for event dispatches (OperationModel.USER_DISPATCH), and another one where API will auto dispatch (OperationModel.API_DISPATCH). In the auto dispatch mechanism, the application should keep main thread alive - which is done in the EMA example with the Thread.sleep() call after registering an item interest with OMMConsumer.

If this main thread terminates, the example uninitializes the consumer and terminates the application - which seems to be the case here. You can wrap this Thread sleep in a loop to prevent it from terminating, or use user dispatch mechanism as shown in series100\example130__MarketPrice__UserDisp example.

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.

Hi Gurpreet, Thanks for your help.I wrapped it into loop and it works.

Can you explain a bit more on API_DISPATCH and USER_DISPATCH? API_PATCH is passive feed and USER_DISPATCH is active query?

Thanks.

The event dispatch mechanism is described in Section 2.4.1 - EMA Consumer Architecture. See API/User dispatch in EMA developers guide.

Upvotes
1 0 0 1

Thank you Gurpreet! This solved my problem. I use while (true) { Thread.sleep(60000) } at the bottom of main(..) to prevent it from exiting. Is 1 minute too short or does it matter. Thanks.


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.

It does not matter since the purpose is to block the main thread while application code runs in a different threads asynchronously.

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.