question

Upvotes
Accepted
1 1 2 5

Connection to EDP – host specification - authentication

Hello, I’m using example450__MarketPrice__QueryServiceDiscovery example for java connection code via EMA.

My user name is “GE-A-0110XXX-x-xxxx”.

(*) I wanted to set the host name in the OmmConsumerConfig but when the host is set the connection fails. Is this a normal behavior? We do not need to specify any host?

(*) Also, do we need to implement specific code in order to refresh the authentication token? I receive the warning log with the “Error text Failed to request authentication token with refresh token for user: GE-A-0110XXX-x-xxxx. Will try again with user name and password.” but the streaming continues. In your example “430_MarketPrice_TrepAuthentication » I saw a “consumer.reissue” instruction. Does “consumer.reissue” take care of refreshing the token? I tried to integrate the “reissue” code in my application but I have a crash at com.thomsonreuters.upa.valueadd.reactor.WlLoginHandler.validateReissue(WlLoginHandler.java:438) as this._loginRequest is null.

elektronrefinitiv-realtimeelektron-sdkema-apirrtelektron-message-api
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
25.3k 87 12 25

Hi @Cornelia.Draculet

I just wish to confirm your understanding of the purpose of the example450. The technique demonstrated is typically used when you wish to use EDP Gateway for service discovery and not necessarily consume market data from EDP- is this the case here?

Can you confirm where in the config you are setting the host and what are you setting the host to? Also, any reason why you wish to override values that EMA session management is setting on your behalf?

With regards obtaining and refreshing tokens - this is carried out on your behalf by Elektron Message API.

Please refer to section 6.3.1 and section 6.6 of the EMA Java Dev Guide for further information on the above topics.

For a simpler ERT in Cloud example, you can refer to example113_MarketPrice_SessionManagement

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
1 1 2 5

Hi @Umer Nalla

Thanks for your answer.

In my application I need to consume market data from EDP.

I also used the sample example113_MarketPrice_SessionManagement in my implementation.

My sample code is as follow (in createProgramaticConfig I do not specify any host and any port for connection – I can send you all the code if need)

AppClient appClient = new AppClient();

OmmConsumer consumer = null;

OmmConsumerConfig config = EmaFactory.createOmmConsumerConfig().config(createProgramaticConfig());

config.tunnelingKeyStoreFile("C:/xxx/keystore/keystore.jks"); config.tunnelingKeyStorePasswd("mykeyXXXX");

config.clientId("xx..580..xx");

config.tunnelingSecurityProtocol("TLS");

-->>>>> this line //config.host("amer-3.pricing.streaming.edp.thomsonreuters.com:14002"); consumer = EmaFactory.createOmmConsumer(config.username("GE-A-0110XXX-x-xxxx").password("GE-XXXX"));

consumer.registerClient( EmaFactory.createReqMsg().serviceName("ELEKTRON_DD").name("IBM.N"), 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
25.3k 87 12 25

Hi @Cornelia.Draculet

As detailed in the documentation, If you set the <Channel> parameter <EnableSessionManagement value="1"/> then EMA discovers a host and a port from EDP-RT service discovery for the specified Location - the default Location is 'us-east'.

If you want to set a specific host and port using programmatic config you can do so e.g..

...
...
configDb.add(EmaFactory.createMapEntry().keyAscii("ConsumerGroup", MapEntry.MapAction.ADD, elementList));
elementList.clear();
innerElementList.add(EmaFactory.createElementEntry().ascii("ChannelType", "ChannelType::RSSL_ENCRYPTED"));
innerElementList.add(EmaFactory.createElementEntry().ascii("Host", "amer-3.pricing.streaming.edp.thomsonreuters.com"));
innerElementList.add(EmaFactory.createElementEntry().ascii("Port", "14002"));
innerElementList.add(EmaFactory.createElementEntry().intValue("EnableSessionManagement", 1));
elementMap.add(EmaFactory.createMapEntry().keyAscii("Channel_1", MapEntry.MapAction.ADD, innerElementList));
innerElementList.clear();
...
...
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
1 1 2 5

Thanks @Umer Nalla,

In fact, in my createProgramaticConfig() function I didn’t set the host and port information, I wanted to add them after OmmConsumerConfig creation. It is just a detail, thanks a lot, it works very well with the new added parameters.

(*) Do you recommend to set the host and the port or to let EDP-RT service find it?

(*) How many connection for a RT server could we have for the same user (GE-A-xxx) ?

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
25.3k 87 12 25

Hi @Cornelia.Draculet

Unless you have a good reason to connect to a specific server (e.g. advised to do so by your Refinitiv Account manager) it makes more sense to let EMA take care of it.
If you are connecting to a specific server then if that server has issues you could lose connectivity.

However, when I tried earlier to use the Location parameter with programmatic config, I could not connect. I could, however, connect when using a EMAConfig.xml file.

I am querying this with our development team - as this is not something I have tested previously and may well be doing something wrong!

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
25.3k 87 12 25

Hi @Cornelia.Draculet

I raised this with our developer support team and they have confirmed the above behaviour I reported - i..e not being able to use Location with programmatic config - is because the EMA Defaulting behaviour is kicking in.

Because I was using Channel_1 in the programmatic config - but not specifying host + port, API is trying to use the default Host + port values from the default Channel_1 config.

To get round this you can change the Channel_1 name to something else in your programmatic config code.

e.g.

... 
innerElementList.add(EmaFactory.createElementEntry().ascii("Channel", "Channel_CD")); 
elementMap.add(EmaFactory.createMapEntry().keyAscii("Consumer_CD", MapEntry.MapAction.ADD, innerElementList)); 
innerElementList.clear(); 
elementList.add(EmaFactory.createElementEntry().map("ConsumerList", elementMap)); 
elementMap.clear(); configDb.add(EmaFactory.createMapEntry().keyAscii("ConsumerGroup", MapEntry.MapAction.ADD, elementList)); 
elementList.clear(); innerElementList.add(EmaFactory.createElementEntry().ascii("ChannelType", "ChannelType::RSSL_ENCRYPTED")); 
innerElementList.add(EmaFactory.createElementEntry().ascii("Location", "us-east")); 
innerElementList.add(EmaFactory.createElementEntry().intValue("EnableSessionManagement", 1)); 
elementMap.add(EmaFactory.createMapEntry().keyAscii("Channel_CD", MapEntry.MapAction.ADD, innerElementList)); 
innerElementList.clear(); 
... 

So, above I am using Channel_CD and Consumer_CD for the respective entry names

and then referring to the alternative Consumer entry when loading the config

consumer = EmaFactory.createOmmConsumer(config.consumerName("Consumer_CD").username(userName).password(password).config(configDb)); 

I did not need to change the Consumer name - but did so just to avoid any other potential default config clashes.

With the above code changes, I was successfully able to connect and consume data - without the need to specify a host.

Another minor point - if you are based in EMEA - you may prefer to use the 'eu-west' location rather than 'us-east'.

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
9.6k 10 7 7

Hello @Cornelia.Draculet

You do not need to specific code in order to refresh the authentication token. The API can perform this on behalf of you when EnableSessionManagement is 1 as shown in example450_MarketPrice_QueryServiceDiscovery.

ETAValueAdd layer in ESDK API refreshes the authentication token. ETAValueAdd requests a new authentication token with a refresh token every 4/5 of the expiration timeout; refresh token and the expiration timeout are in the token response received previously. If it fails to get authentication token, it will use username and password to request a new authentication token again and the application will receives “Error text Failed to request authentication token with refresh token for user: GE-A-0110XXX-x-xxxx. Will try again with user name and password.”. Once a new authentication token is received, EMA will reissue login with the new token to ADS to keep the connection alive. The refresh token and reissue login process is shown in the diagram below:

The streaming still continues after you receive the error text because

  • It is not the end of the expiration timeout yet (refreshing token is performed every 4/5 of the expiration timeout).
  • EMA reissues login with the new token requested with username and password to ADS before the end of the expiration timeout. Then, your application can continue getting data.

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.