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
@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.
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?
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.