[EMA Java] How to receive connection level events such as a disconnection?

I am trying to integrate EMA in our proprietary framework, where I need to publish events and alerts should the connection to Reuters fail. I cannot seem to be able to consume such events through the OmmConsumerClient interface.

What would be the best way to receive those? Do I need to manually issue a source directory request message?

When I forcibly close the connection by terminating the VPN, I see a message in the logs but the OmmConsumerClient is not called.

Example:

2018-11-29 09:39:07,157 WARN [pool-2-thread-1] | com.thomsonreuters.ema.access.OmmConsumerImpl | | loggerMsg

ClientName: ChannelCallbackClient

Severity: Warning

Text: Received ChannelDownReconnecting event on channel Channel

RsslReactor Channel is null

Error Id 0

Internal sysError 0

Error Location Reactor.processWorkerEvent

Error text Error - exceeded initialization timeout (5 s)

loggerMsgEnd

Best Answer

  • Hi @andre.malenfant

    If you want to monitor connection loss, you can explicitly registerClient for the MMT_LOGIN domain. This way you will receive Status Msg when the connection is lost and RefreshMsg when connection is restored and the application successfully logs back into the server again.

    So, for example if I run the example example330 Login_Streaming,which registers for MMT_LOGIN (and IBM.N MarketPrice).

    The stream with Item Handle 1 is the Login stream below.

    When I disconnect my VPN I get the following:

    Received Status. Item Handle: 1 Closure: null
    Item Name: umer.nalla
    Service Name: <not set>
    Item State: Open / Suspect / None / 'channel down'
    Received Status. Item Handle: 1 Closure: null
    Item Name: <not set>
    Service Name: <not set>
    Item State: Open / Suspect / None / ''
    Received Status. Item Handle: 2 Closure: null
    Item Name: IBM.N
    Service Name: ELEKTRON_DD
    Item State: Open / Suspect / None / 'channel down.'

    and when I reconnect my VPN I get:

    Received Refresh. Item Handle: 1 Closure: null
    Item Name: umer.nalla
    Service Name: <not set>
    Item State: Open / Ok / None / 'Login accepted by host test1-ads.'
    Received Status. Item Handle: 1 Closure: null
    Item Name: umer.nalla
    Service Name: <not set>
    Item State: Open / Ok / None / 'channel up'
    Received Refresh. Item Handle: 2 Closure: null
    Item Name: IBM.N
    Service Name: ELEKTRON_DD

    If you want to know about individual Service states i.e. if a particular service goes down and then comes back up, then you can register for MMT_DIRECTORY domain events as you mentioned above. This is demonstrated in example331 Directory_Streaming.
    Note that if you specify a ServiceName, it will only provide information on that single service. If you want to know about all services, then omit the servicename.

    consumer.registerClient(reqMsg.domainType(EmaRdm.MMT_DIRECTORY)
    .serviceName("ELEKTRON_DD"), appClient);

Answers

  • Thanks for that, where can I find example 330?

  • Hi @andre.malenfant

    The examples should be in the EMA Examples subfolder when you install the Elektron Java SDK

    e.g. for 330 :

    Java\Ema\Examples\src\main\java\com\thomsonreuters\ema\examples\training\consumer\series300\example330__Login__Streaming

    If you don't have full SDK please download from Elektron SDK - Java Downloads

  • Thanks for the info, I am getting somewhere now.

    But, I only receive a notification once for the first failure. I would be interested in receiving failed reconnection attemps such as:

    2018-12-05 11:34:45,209 WARN [pool-2-thread-1] | com.thomsonreuters.ema.access.OmmConsumerImpl | | loggerMsg ClientName: ChannelCallbackClient Severity: Warning Text: Received ChannelDownReconnecting event on channel Channel RsslReactor Channel is null Error Id 0 Internal sysError 0 Error Location Reactor.processWorkerEvent Error text Error - exceeded initialization timeout (5 s) loggerMsgEnd

  • Hi @andre.malenfant,

    The only way I believe you can capture these reconnection attempt messages is to create a Logger handler within your code. Within the SpeedGuide utility, I created a handler class called: StatusLogHandler within the file SpeedGuideConsumer.java which allows you to get the contents of the message coming from logs and peel apart the details. It is used as a status display within Speed Guide display.

    image

  • Thanks for taking the time to figure this out. It's unfortunate that we don't receive additional status messages for re-connections. I would I liked to use that as a way to not be trigger happy on the alerts but it seems that I will send alerts on the first failure, as I do not want to rely on parsing a logger output that is prone to change over time.

    Thanks again @Umer Nalla and @nick.zincone.1 for your help!