EMA C++ - Reconnection to ADS

Hi ,

Is there any callback , or an exception thrown when the connection to ADS Server is lost ?

Basically to handle reconnect behaviour in EMA Consumer - C++ clients

Best Answer

  • Please refer to the EmaCPP_ConfigGuide.pdf which comes with the SDK.

    You can set the filename +path by amending your Logger entry in the EmaConfig.xml or via your programmatic config.

    <Logger>
    <Name value="Logger_2"/>
    <LoggerType value="LoggerType::File"/>
    <!-- FileName is optional: defaulted to "emaLog_<process id>.log"-->
    <FileName value="c:\temp\emaLogUN"/>
    <LoggerSeverity value="LoggerSeverity::Success"/>
    </Logger>

    Obviously, you will need to change your Consumer Config definition to reference the correct Logger config e.g. in this case Logger_2

    Also, if you want to know the state of connectivity to server within the application, you can manually register for the Login Domain stream.

    Please refer to the 330__Login__Streaming example that comes with the SDK. Also, refer to the 360__MarketPrice__ConnectionRecovery example which uses the login state to control its behaviour.

    So, for example with the above example you may get something like the following when the connection to server is lost after a previously successful login and connection:

    Item Name: user
    Service Name: <not set>
    Item State: Open / Suspect / None / 'channel down'
    loggerMsg
    TimeStamp: 12:09:10.070
    ClientName: LoginCallbackClient
    Severity: Warning
    Text: RDMLogin stream state was changed to suspect with status message
    username user
    usernameType 1
    .....
    State: Open / Suspect / None / 'Channel is down.'
    loggerMsgEnd

    And then something like the following when the connection is restored:

    Item Name: user
    Service Name: <not set>
    Item State: Open / Ok / None / 'channel up'
    Handle: 2424268995088 Closure: 0000000000000001
    Item Name: user
    Service Name: <not set>
    Item State: Open / Ok / None / 'Login accepted by host training1x.'
    ......

    Hope that helps.

Answers

  • Regarding callback for connection lost, you can refer to the answer in this question.

    For recovery, EMA will reconnect to the server and then re-request all subscribed items on behalf of application. Application will receive refresh messages for all items.

  • Thanks a lot - The events are also logged in emaLog .

    Could you please help specifying a definite location for emaLog instead of the directory in which application is run ?