Need support for connecting to RTO v2

philippe.mesmeur
philippe.mesmeur Newcomer
edited 1:52PM in EMA

Hi,

I have to update the code of a software so that it supports RTO v2 (previously it was supporting RTO v1)

In RTO v1, I used to connect thanks to the following code:

    private OmmConsumer createOmmConsumer() {
        OmmConsumerConfig ommConsumerConfig = EmaFactory.createOmmConsumerConfig(configuration.getConfigurationFile());

        ommConsumerConfig.username(configuration.getUserName());
        ommConsumerConfig.position(configuration.getPosition());
        ommConsumerConfig.applicationId(configuration.getApplicationId().toString());
        ommConsumerConfig.password(configuration.getPassword());
        ommConsumerConfig.tunnelingKeyStorePasswd(configuration.getPassword());
        ommConsumerConfig.clientId(configuration.getClientId());

        return EmaFactory.createOmmConsumer(ommConsumerConfig, stateClient);
    }

I know that in RTO v2 the ommConsumerConfig should be configured differently

  • could you please send me an example?
  • do you confirm it should be something like that?
OmmConsumerConfig config = EmaFactory.createOmmConsumerConfig();

consumer  = EmaFactory.createOmmConsumer(config.consumerName("Consumer_1").clientSecret(credentials.clientSecret)
		        clientId(credentials.clientId).tokenServiceUrlV2(tokenUrlV2).config(configDb), oAuthCallback, (Object)credentials);

It seems that I need a clientSecret. I was given an access to the "LSEG Platform Administration" and I found account I want to use:


However, I don't know how to get/change the secret to be used?

Thanks for helping

Regards,

Philippe

Answers

  • Hello @philippe.mesmeur

    Please see this EMA Session Management example which shows how to use the Client Credentials (v2) authentication. Its recommended that application should use Service Discovery before connecting to the streaming host, since the hosts can change and discovery will return the list which is based on user's license.

    OmmConsumerConfig config = EmaFactory.createOmmConsumerConfig();
    config.clientId("xxxxxxx");
    config.clientSecret("xxxxxxx");
    consumer  = EmaFactory.createOmmConsumer(config);
    
    

    All other parameters like session management and the location of the streaming server can be specified in the EMAConfig.xml or programmatically.

    If you are interested in providing programmatic config, then see this EMA example.

    I would recommend that you run the examples before trying changes in your code. For account related questions like client ID, client secret etc, please reach out to your LSEG account manager.