question

Upvotes
Accepted
1 1 2 3

how to make EmaFactory to connect with the second host if the first host can not be connected

Hi, We are using the thomson-reuters-ema java api (version 3.5.1.0) to connect the EAM server. Recently we got a lot of errors like:


loggerMsg

ClientName: EmaConsumer_287

Severity: Error

Text: login failed (timed out after waiting 45000 milliseconds) for xxxxxxxx.europe.intranet:14002)

loggerMsgEnd


It turned out that a particular server was in maintenance. The others configured servers in hosts should be functioning. However, the EmaFactory is always trying to connect with the first host, and did not try the other hosts in the host list.


This log is generated by the EmaFactory, which cannot be modified by us. So the question is, how to let the EmaFactory only try once for the connection of each host? If it failed, then try another host? Currently it seems that the EmaFactory is always trying to connect with the first host in the host list.


Below is our code to connect to the EMA host, thanks.

--------------------------------------------------------------------

private OmmConsumer getOmmConsumer() {

OmmConsumer consumer;

for (String host : hosts) {

try {

LOGGER.debug("Start to connect with Trep Server: {} --- {}", host, user);

OmmConsumerConfig config = EmaFactory.createOmmConsumerConfig();

consumer = EmaFactory.createOmmConsumer(config.host(host).username(user).applicationId(APPLICATION_ID));

return consumer;

} catch (OmmException exception) {

LOGGER.warn(exception.getMessage());

}

}

return null;

}


elektronrefinitiv-realtimeelektron-sdkema-apirrtelektron-message-apirefinitiv-realtime-sdk
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.

@ning.kang

Hi,

Thank you for your participation in the forum.

Are any of the replies below satisfactory in resolving your query?

If yes please click the 'Accept' text next to the most appropriate reply. This will guide all community members who have a similar question.

Otherwise please post again offering further insight into your question.

Thanks,

AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,

AHS

Upvotes
Accepted
7.6k 15 6 9

@ning.kang

OmmConsumerConfig.host(String) is to specify a hostname and port that EMA will connect to so it does not accept multiple hosts. You may need to use ChannelSet, as described in the following post instead.

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.6k 54 17 14

Hello @ning.kang

There is also the Enterprise Message API (EMA) - Configuration Overview article that will give you an explanation regarding EMA Config file. Please refer to "Channels and ChannelSets" section in the article.

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.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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