question

Upvotes
Accepted
7 3 2 5

[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

elektronrefinitiv-realtimeelektron-sdkrrtema-apielektron-message-apijavaconnection
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.

Upvotes
Accepted
24.9k 86 10 22

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);
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.

Upvotes
7 3 2 5

Thanks for that, where can I find example 330?

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.

Upvotes
24.9k 86 10 22

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

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.

Upvotes
7 3 2 5

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

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.

Upvote
13k 61 39 63

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.


ahs.png (79.0 KiB)
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.

Upvotes
7 3 2 5

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!

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.