Does consumer need unregister all instruments before consumer.uninitialize()

HSIL_Kevin_Sun
HSIL_Kevin_Sun Newcomer
edited May 13 in EMA

As far as I know, for any unsuccessful item subscription,  the application will receive a Status message with OmmState.StreamState.CLOSED and OmmState.DataState.SUSPECT via onStatusMsg(..).
When the application receives a StatusMsg with Stream.Close / Data.Suspect after calling consumer.uninitialize(), but not if consumer.unregister() is called before consumer.uninitialize().

I think when the application actively releases the consumer's connection, it should not receive Stream.Close / Data.Suspect, so should we call consumer.unregister() before calling consumer.uninitialize()?

Btw, Many code examples call consumer.uninitialize() directly at the end of the program. So I'm a bit confused as to how I should implement this ?

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @HSIL_Kevin_Sun

    Thank you for reaching out to us.

    The following is the call stack when the consumer is uninitialized.

    image.png

    According to the call stack, the API will fanout the closed status messages to all streams. This could be by design.

    If you are a RDC named user, you can contact the API support team directly via Contact Premium Support to verify this behavior.

    Yes, you can unregister all streams before calling consumer.uninitialize(). I checked and found that the unregistered items will not receive status close messages when the consumer is uninitialized.