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

hujunhu
hujunhu Explorer

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

image

Best Answer

  • Gurpreet
    Gurpreet admin
    Answer ✓

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

Answers