Is OnStatusMsg is sufficient for handling Connection State, State of Item and other states related

Dears @nick.zincone.1, @Umer Nalla, @Olivier DAVANT

Is OnStatusMsg is sufficient for handling Connection State, State of Item and other states related to data retrieval using EMA? Or is there any other API we need to take care while handling certain events related to Connection, Item States.

Thanks and Regards,

Gaurav Mahajan

Best Answer

  • Hi @gaurav.mahajan,

    The OnStatusMsg is typically associated with asynchronous attribute changes related to an already opened event stream. In addition, status messages are also delivered if Elektron informs you that a request to login or to retrieve data fails. Reasons such as invalid user credentials when you log in or you have requested an invalid market data item.

    Actual connection-related events are not delivered through the OnStatusMsg handler. EMA has built-in connection management - retries, recovery etc. For example, if you are watching 2 items and your connection goes down, you won't get an explicit event within the OnStatasMsg saying your channel went down, but rather, 2 status events indicating that your 2 opened event streams are in a state of "Suspect" and the reason being that the channel is down. The items remain open so EMA can recover upon re connection.

    If you look at a simple running example, you will see that EMA does report connection events within the logger.

    Hope this helps.