question

Upvote
Accepted
15 2 4 9

RTSDK/C++ how to recover from a login, channel or stream down situation

Hi,

We are reading market data using Real-Time Optimized

As per the training code sample, the OmmConsumer object is created and multiple instruments (clients) are registered

The system works well, so we get onRefreshMsg(), or onUpdateMsg() calls with the data

When there is an error in emaLog, e.g.:

loggerMsg

TimeStamp: 12:42:24.241

ClientName: LoginCallbackClient

Severity: Error

Text: RDMLogin stream was closed with status message

<text removed>

State: Closed / Suspect / Internal error from sender / 'Login Denied:Failed to validate sso token'

loggerMsgEnd

Then our system no longer receives any more updates on any of the instruments

How do we check if we have lost the stream or connection?

How do we reconnect?

We have some commented out code in onStatusMsg(), i.e.:

if (statusMsg.hasState() && statusMsg.getState().getStreamState() == OmmState::OpenEnum)

{

}

If this is the right place to check for an error, then how do we recover the login, channel or stream?

Thanks

ema-apirrto
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Upvotes
Accepted
49.8k 124 44 62

@manjinder.singh

The status message "Closed / Suspect" on a Login stream indicates that a login stream has been closed. A closed login stream also cuts a connection and API will not recover a connection.

The application needs to re-create the OMMConsumer to re-open the login stream to reconnect to the server. For more information, please refer to the following threads:

An RTO account can't be used simultaneously. Please make sure that there is only one application that uses an RTO account.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thank you

Please can you provide me the status enum for which we need to re-open the login stream. Is it a case of catch all?, e.g.:

if (statusMsg.hasState() && statusMsg.getState().getStreamState() != OmmState::OpenEnum)

{

// recreate OmmConsumer and register instruments

}

or do I need to check for the following enums:

ClosedEnum

ChannelUnavailableEnum

LoginClosedEnum

NotOpenEnum

ServiceDownEnum

ServiceUnavailableEnum

Which ones mean the system has disconnected for which we need to re-open the login?

@manjinder.singh

In this scenario, you need to check the stream state of the Login domain. If the stream state of the Login domain is equal to OmmState::ClosedEnum, the application needs to re-create the OMMConsumer to re-open the login stream to reconnect to the server.

    if (statusMsg.getDomainType() == MMT_LOGIN)
    {
        if (statusMsg.hasState()) {
            if (statusMsg.getState().getStreamState() == OmmState::ClosedEnum) {
             ....
            }
      }
    }
    
Thank you, I will code the reconnect into our application

Also regarding the other enums I mentioned, do we need to do anything with those?

Show more comments