question

Upvotes
Accepted
3 0 1 5

[EMA Consumer JAVA RTO] connection to aws endpoint fails with a valid credential

Hello team,

I am facing an issue when connecting to RTO using EMA, below is my code:


  
                
  1. Map elementMap = EmaFactory.createMap();
  2. ElementList elementList = EmaFactory.createElementList();
  3. ElementList innerElementList = EmaFactory.createElementList();
  4.  
  5. innerElementList.add(EmaFactory.createElementEntry().ascii("Channel", "Channel_1"));
  6. elementMap.add(EmaFactory.createMapEntry().keyAscii("Consumer_1", MapEntry.MapAction.ADD, innerElementList));
  7. innerElementList.clear();
  8.  
  9. elementList.add(EmaFactory.createElementEntry().map("ConsumerList", elementMap));
  10. elementMap.clear();
  11.  
  12. Map configDb = EmaFactory.createMap();
  13. configDb.add(EmaFactory.createMapEntry().keyAscii("ConsumerGroup", MapEntry.MapAction.ADD, elementList));
  14. elementList.clear();
  15.  
  16. innerElementList.add(EmaFactory.createElementEntry().ascii("ChannelType", "ChannelType::RSSL_WEBSOCKET"));
  17.  
  18.  
  19. // discoveryClient is of ServiceEndpointDiscoveryClient type implementing onSuccess()
  20. // This client was registered using the same clientId & secret as bellow and the endpoint
  21. // was successfully discovered
  22. innerElementList.add(EmaFactory.createElementEntry().ascii("Host", discoveryClient.getHost()));
  23. innerElementList.add(EmaFactory.createElementEntry().ascii("Port", discoveryClient.getPort()));
  24. innerElementList.add(EmaFactory.createElementEntry().intValue("EnableSessionManagement", 1));
  25.  
  26. elementMap.add(EmaFactory.createMapEntry().keyAscii("Channel_1", MapEntry.MapAction.ADD, innerElementList));
  27. innerElementList.clear();
  28.  
  29. elementList.add(EmaFactory.createElementEntry().map("ChannelList", elementMap));
  30. elementMap.clear();
  31.  
  32. configDb.add(EmaFactory.createMapEntry().keyAscii("ChannelGroup", MapEntry.MapAction.ADD, elementList));
  33. elementList.clear();
  34.  
  35. try {
  36. OmmConsumerConfig subscriptionConfig = EmaFactory.createOmmConsumerConfig();
  37.  
  38. // And finally create the consummer
  39. OmmConsumer subscriptionRTOConsumer = EmaFactory.createOmmConsumer(subscriptionConfig.consumerName("Consumer_1")
  40. .clientId(XXXX)
  41. .clientSecret(XXXXXXX)
  42. .tokenServiceUrlV2("api.refinitiv.com/auth/oauth2/v2/token")
  43. .config(configDb));
  44.  


On the consumer creation, I have many login retry errors like this:

  
                
  1. 2023-12-20 13:19:17:566 ERROR main access.OmmConsumerImpl:675 - loggerMsg
  2.     ClientName: ChannelCallbackClient
  3.     Severity: Error
  4.     Text:    Received ChannelDown event on channel Channel_1
  5.     Instance Name Consumer_1_1
  6.     RsslReactor @2dca0d64
  7.     RsslChannel @7b84fcf8
  8.     Error Id 0
  9.     Internal sysError 0
  10.     Error Location Reactor.processWorkerEvent
  11.     Error text Error - exceeded initialization timeout (5 s)
  12. loggerMsgEnd


And the final error:

  
                
  1. 2023-12-20 13:26:17:798 ERROR main refinitiv.RefinitivRTOSource:189 - Cannot start connector for client Id [XXXXX], invalid usage: login failed (timed out after waiting 45000 milliseconds) for eu-west-1-aws-3-sm.optimized-pricing-api.refinitiv.net:443)


Any help would be appreciated,

Many thanks

#technologyema-apirrtoauthentication
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.

Hi @DimAngelNX ,

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?
If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,
AHS

@DimAngelNX

Hi,

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

Thanks,

AHS

Upvote
Accepted
24.7k 54 17 14

Hello @DimAngelNX

The "login failed (timed out after waiting 45000 milliseconds) for eu-central-1-aws-3-sm.optimized-pricing-api.refinitiv.net:443)" login error message indicates that the API cannot establish the WebSocket connection and sends the WebSocket Login request message to the eu-central-1-aws-3-sm.optimized-pricing-api.refinitiv.net WebSocket server on port 443. The error message is not related to the Authentication token.

The service discovery uses the HTTP connection (GET /streaming/pricing/v1/ HTTP/1.1) connects to the RDP API gateway (https://api.refinitiv.com), not the WebSocket connection.

Like @Jirapongse suggestion, the WebSocket connection may be blocked by a firewall or network policy.

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.

Hello @Jirapongse , @wasin.w ,


After analysis fro mthe network team here is what I have on teh network log:

Connection terminated before the Security Gateway was able to make a decision: Insufficient data passed.


Any suggestions on what could be the problem?

Thanks a lot

According to the network log, it should not relate to the API.

You need to the contact the firewall support team to verify this error.

Upvotes
79.2k 251 52 74

@DimAngelNX

Thank you for reaching out to us.

You need to compare the code with the ex450_MP_QueryServiceDiscovery example.

You can run it with the following parameters.

$>gradlew.bat runconsumer450 --args="-clientId <ClientID> -clientSecret <ClientSecret> -itemName EUR="

According to the log, it looks like that the application uses the WebSocket connection (TCP 443).

2023-12-20 13:26:17:798 ERROR main refinitiv.RefinitivRTOSource:189 - Cannot start connector for client Id [XXXXX], invalid usage: login failed (timed out after waiting 45000 milliseconds) for eu-west-1-aws-3-sm.optimized-pricing-api.refinitiv.net:443)

RTO supports both the encrypted WebSocket (443) and encrypted TCP (14002) connection types.

Please check the connection type that you want to connect.

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

Hello @DimAngelNX

The configDB code is missing some statements for the RTO-WebSocket connection as follows:

  • You need to specify Dictionary node to DictionaryType::FileDictionary type for loading field dictionary information from local files (the WebSocket connection cannot load dictionary information from the server)
  • The ChannelType must be "ChannelType::RSSL_ENCRYPTED"
  • You need to add "EncryptedProtocolType" node with "EncryptedProtocolType::RSSL_WEBSOCKET" value
  • You need to add ""WsProtocols"" node with "tr_json2" value

Example Source Code (see the italic bold lines):

Map elementMap = EmaFactory.createMap();
ElementList elementList = EmaFactory.createElementList();
ElementList innerElementList = EmaFactory.createElementList();

innerElementList.add(EmaFactory.createElementEntry().ascii("Channel", "Channel_1"));

innerElementList.add(EmaFactory.createElementEntry().ascii("Dictionary", "Dictionary_1"));

elementMap.add(EmaFactory.createMapEntry().keyAscii("Consumer_1", MapEntry.MapAction.ADD, innerElementList));
innerElementList.clear();

elementList.add(EmaFactory.createElementEntry().map("ConsumerList", elementMap));
elementMap.clear();
Map configDb = EmaFactory.createMap();
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("EncryptedProtocolType", "EncryptedProtocolType::RSSL_WEBSOCKET"));
innerElementList.add(EmaFactory.createElementEntry().ascii("WsProtocols", "tr_json2"));

// discoveryClient is of ServiceEndpointDiscoveryClient type implementing onSuccess()
// This client was registered using the same clientId & secret as bellow and the endpoint
// was successfully discovered
innerElementList.add(EmaFactory.createElementEntry().ascii("Host", {host}));
innerElementList.add(EmaFactory.createElementEntry().ascii("Port", {port}));
innerElementList.add(EmaFactory.createElementEntry().intValue("EnableSessionManagement", 1));

elementMap.add(EmaFactory.createMapEntry().keyAscii("Channel_1", MapEntry.MapAction.ADD, innerElementList));
innerElementList.clear();

elementList.add(EmaFactory.createElementEntry().map("ChannelList", elementMap));
elementMap.clear();

configDb.add(EmaFactory.createMapEntry().keyAscii("ChannelGroup", MapEntry.MapAction.ADD, elementList));
elementList.clear();

innerElementList.add( EmaFactory.createElementEntry().ascii( "DictionaryType", "DictionaryType::FileDictionary" ));
innerElementList.add( EmaFactory.createElementEntry().ascii( "RdmFieldDictionaryFileName", "C:\\etc\\RDMFieldDictionary" )); <-- must be match your local folder
innerElementList.add( EmaFactory.createElementEntry().ascii( "EnumTypeDefFileName", "C:\\etc\\enumtype.def" )); <-- must be match your local folder
elementMap.add( EmaFactory.createMapEntry().keyAscii( "Dictionary_1", MapEntry.MapAction.ADD, innerElementList ));
innerElementList.clear();

elementList.add( EmaFactory.createElementEntry().map( "DictionaryList", elementMap ));
elementMap.clear();
configDb.add( EmaFactory.createMapEntry().keyAscii( "DictionaryGroup", MapEntry.MapAction.ADD, elementList ));
elementList.clear();
...

You can check the ex450_MP_QueryServiceDiscovery example as suggested by my colleauge.

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
3 0 1 5

Hello @wasin.w ,

Thank you for your reply.


I've already tried to use encrypted channel type like this:

innerElementList.add(EmaFactory.createElementEntry().ascii("ChannelType", "ChannelType::RSSL_ENCRYPTED"));
innerElementList.add(EmaFactory.createElementEntry().ascii("EncryptedProtocolType", "EncryptedProtocolType::RSSL_WEBSOCKET"));

But I have an assertion error comming from EMA when registering the OmmConsumerClient:

java.lang.AssertionError: KeystorePasswd must be non-null
    at com.refinitiv.eta.transport.EncryptionOptionsImpl.KeystorePasswd(EncryptionOptionsImpl.java:145)
    at com.refinitiv.ema.access.ChannelCallbackClient.readEncryptedChannelConfig(ChannelCallbackClient.java:1566)
    at com.refinitiv.ema.access.ChannelCallbackClient.tunnelingConfiguration(ChannelCallbackClient.java:1399)
    at com.refinitiv.ema.access.ChannelCallbackClient.channelConfigToReactorConnectInfo(ChannelCallbackClient.java:904)
    at com.refinitiv.ema.access.ChannelCallbackClient.initializeReactor(ChannelCallbackClient.java:1045)
    at com.refinitiv.ema.access.ChannelCallbackClient.initializeConsumerRole(ChannelCallbackClient.java:1304)
    at com.refinitiv.ema.access.OmmConsumerImpl.handleAdminDomains(OmmConsumerImpl.java:632)
    at com.refinitiv.ema.access.OmmBaseImpl.initialize(OmmBaseImpl.java:346)
    at com.refinitiv.ema.access.OmmConsumerImpl.<init>(OmmConsumerImpl.java:47)
    at com.refinitiv.ema.access.EmaFactory.createOmmConsumer(EmaFactory.java:237)


Any suggestions?

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
79.2k 251 52 74

@DimAngelNX

I got the same error when enable assertions (-ea) in JVM

Exception in thread "main" java.lang.AssertionError: KeystorePasswd must be non-null
    at com.refinitiv.eta.transport.EncryptionOptionsImpl.KeystorePasswd(EncryptionOptionsImpl.java:145)
    at com.refinitiv.ema.access.ChannelCallbackClient.readEncryptedChannelConfig(ChannelCallbackClient.java:1566)
    at com.refinitiv.ema.access.ChannelCallbackClient.tunnelingConfiguration(ChannelCallbackClient.java:1399)
    at com.refinitiv.ema.access.ChannelCallbackClient.channelConfigToReactorConnectInfo(ChannelCallbackClient.java:904)
    at com.refinitiv.ema.access.ChannelCallbackClient.initializeReactor(ChannelCallbackClient.java:1045)
    at com.refinitiv.ema.access.ChannelCallbackClient.initializeConsumerRole(ChannelCallbackClient.java:1304)
    at com.refinitiv.ema.access.OmmConsumerImpl.handleAdminDomains(OmmConsumerImpl.java:632)
    at com.refinitiv.ema.access.OmmBaseImpl.initialize(OmmBaseImpl.java:346)
    at com.refinitiv.ema.access.OmmConsumerImpl.<init>(OmmConsumerImpl.java:47)
    at com.refinitiv.ema.access.EmaFactory.createOmmConsumer(EmaFactory.java:237)
    at com.refinitiv.ema.examples.training.consumer.series400.ex450_MP_QueryServiceDiscovery.Consumer.main(Consumer.java:474)

It works fine if I disable assertions.

If you are a Refinitiv Developer Connect (RDC) named user, you can submit this issue via Contact Premium Support. Otherwise, you can raise this issue on GitHub.

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.

Hello @Jirapongse ,

Thank you for your reply, disabling assertions fixed this particular issue.

But after considering all comments above, my code still fails with the following errors:

2024-01-02 09:55:53:489  WARN main access.OmmConsumerImpl:619 - loggerMsg
    ClientName: ChannelCallbackClient
    Severity: Warning
    Text:    Received ChannelDownReconnecting event on channel Channel_2
RsslReactor @377c68c6
RsslChannel @538cd0f2
Error Id 0
Internal sysError 0
Error Location Reactor.processWorkerEvent
Error text Error - exceeded initialization timeout (5 s)
loggerMsgEnd


2024-01-02 09:56:01:316 ERROR main access.OmmConsumerImpl:1717 - loggerMsg
    ClientName: Consumer_2_1
    Severity: Error
    Text:    login failed (timed out after waiting 45000 milliseconds) for eu-central-1-aws-3-sm.optimized-pricing-api.refinitiv.net:443)
loggerMsgEnd


2024-01-02 09:56:01:319 ERROR main access.OmmConsumerImpl:675 - loggerMsg
    ClientName: ChannelCallbackClient
    Severity: Error
    Text:    Received ChannelDown event on channel Channel_2
Instance Name Consumer_2_1
RsslReactor @377c68c6
RsslChannel @22df874e
Error Id 0
Internal sysError 0
Error Location Reactor.processWorkerEvent
Error text Error - exceeded initialization timeout (5 s)
loggerMsgEnd

I suspect this is a token issue, althought use V2 authentication with

<EnableSessionManagement value="1"/>

Any suggestions?

Thank you

Upvotes
79.2k 251 52 74

@DimAngelNX

The error indicates the the API was unable to establish a connection to the server (eu-central-1-aws-3-sm.optimized-pricing-api.refinitiv.net:443). The connection may be blocked by a firewall or network policy. You need to contact your IT support team to verify the connection.

Otherwise, you can try other servers.

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.

@Jirapongse

My service discovery client successfully manages to connect whit the clientId and secret and discovers the aws hosts, additionnally I checked the connection with my IT team and it is OK, so I suppose no problem on connection side.

But as the log posted above is saying login failed, I suppose there is a problem with auth token?



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.