Java RealTime SDK: how to detect RIC closed by ATS then reopened

philippe.mesmeur
philippe.mesmeur Newcomer
edited February 28 in EMA

Hello

I am using Java RealTime SDK to connect my application to TREP.

    <dependency>
<groupId>com.refinitiv.ema</groupId>
<artifactId>ema</artifactId>
<version>3.7.3.0</version>
</dependency>

It is able to subscribe for RICs and to receive realtime market data

One of our client complaints about an issue when consuming RICs published from ATS:

  1. my application connects to TREP and subscribes to a RIC published from ATS by the customer
  2. my application correctly receives to image and the updates of the RIC
  3. client closes the RIC on ATS
  4. client reopens the RIC on ATS
  5. starting from now, my application does not receive anymore RIC updates

In order to bypass this issue, the client needs to restart the application (I guess a resubscription to the RIC is needed)

I contact you in order to know what is the best thing to do in this situation?

  • I guess that if the application resubscribes to the RIC when receiving the RIC-closed notification, the new subscription will be refused
  • so I would like my application being notified when the RIC is reopened: is there a way to do this?
  • or is there another solution offered by the SDK that I don't yet know?

Thank you very much

Regards

Philippe MESMEUR

Answers

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @philippe.mesmeur

    Thank you for reaching out to us.

    This is strange. Typically, the application can close the stream by calling the unregister method.

    void unregister​(long handle)
    

    Relinquishes interest in an open item stream.

    Then, the application can subscribe to item by calling the registerClient method.

    long registerClient​(ReqMsg reqMsg, OmmConsumerClient client)
    Opens an item stream.

    To verify the problem and avoid all known issues, the client can update the version of EMA to 3.8.3.0.

    Then, enable the debug log and XML trace to check the behaviors in EMA.

  • Hi,

    it was more or less clear to me that I had to unsubscribe the resubscribe to the RIC (by calling unregister()/registerClient()).

    Calling unregister() is rather easy: I can to it when being notified that the RIC was closed

    But when should I call registerClient()?

    • I imagine that if I call it while the RIC is still closed, I will be notified… that the RIC is closed
    • so I can do it "only" when the RIC is opened: but how can I know that the RIC is open?

    Does RealTime SDK offers feature for being notified that a RIC "switches" from closed to opened?

    Thanks for helping

    Regards,

    Philippe

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    @philippe.mesmeur

    The opened streams can be closed by the server and the client's application.

    • The server can close the opened streams by sending the messages with the closed stream states. The application can check the stream states via the EMA callback methods. In this case, the application will not call the unregister method to close the stream.
    • The application calls the unregister method to close the opened streams.

    The Enterprise Message API assigns all opened items or instruments a unique numeric id (handle). The application should maintain which handles have been closed either by the server or the application.

    For more information, please refer to this discussion's thread.

  • Ok, thank you for clarification

    The application can check the stream states via the EMA callback methods. In this case, the application will not call the unregister method to close the stream.

    Please let me know if I'm right or wrong; As I understand, my application can/should "listen" to EMA events in order to be notified about stream state changes, e.g. when a RIC is closed

    When being notified of a "RIC closure", my application should not close the RIC, i.e. it should not call the unregister() method

    Am I right?

    what will happen next? how my application will be notified that the RIC is opened again?

    If possible, I would appreciate a sample

    Thanks for all

    Regards,

    Philippe

  • Jirapongse
    Jirapongse ✭✭✭✭✭
    edited March 4

    The full one is:

    The server can close the opened streams by sending the messages with the closed stream states. The application can check the stream states via the EMA callback methods. In this case, the application will not call the unregister method to close the stream.

    This is valid when the server closes the streams.

    After the stream is closed, the application can open it again by calling the registerClient method. This method will return a handle. The application will be notified that the stream is open or closed via the callback methods.

  • After the stream is closed, the application can open it again by calling the registerClient method…

    so as I understand, when receiving a "RIC closed" status, my application has to resubscribe to it.

    The application will be notified that the stream is open or closed via the callback methods

    However, if the RIC is still closed, my application will will receive once again a "RIC closed" status

    ⇒ so I guess my application should subscribe again and again to the RIC until it get a "RIC opened" status

    In other words, RealTime SDK does not provide a way for notifying that a RIC switches from closed to opened: am I right?

    Regards,

    Philippe

  • Jirapongse
    Jirapongse ✭✭✭✭✭

    Yes, when the stream was closed, the only way to reopen it is resubscribing.