Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OmmConsumerConfig - Set ApplicationName #293

Open
Daniela-O opened this issue Nov 20, 2024 · 4 comments
Open

OmmConsumerConfig - Set ApplicationName #293

Daniela-O opened this issue Nov 20, 2024 · 4 comments

Comments

@Daniela-O
Copy link

Hello, we have a Java application that connects to RTDS to get data from a service and publishes to another service. Data retrieval and publishing are executed via 2 different modules. Each of the 2 modules implement OmmConsumerClient.

We are experiencing issues when running the solution on the customer environment, where publishing is successful very rarely.

We have been told from RTDS experts that in some occasions the new RTMDS V3 has issues with applications connecting with the same Application Name.

By enabling Ema logs we see indeed that both modules connect using the same name "ema":

<elementEntry name="ApplicationName" dataType="ASCII_STRING" data="ema"/>

Currently there is no way to set the Application Name in Ema. We are currently using Ema 3.8.0.0, but we do not see that option even in the latest 3.8.2.0.

Can you give the possibility to set the Application Name when creating the OmmConsumerConfig?

@soranat
Copy link
Contributor

soranat commented Nov 21, 2024

You can override the default application name via the admin domain configuration in EMA. The following is the sample code to set an application name and other attributes for login domain to OmmConsumerConfig.

 ElementList elementList= EmaFactory.createElementList();
elementList.add(EmaFactory.createElementEntry().ascii(EmaRdm.ENAME_APP_NAME, "applicationname"));
elementList.add(EmaFactory.createElementEntry().ascii(EmaRdm.ENAME_APP_ID, "127"));
elementList.add(EmaFactory.createElementEntry().ascii(EmaRdm.ENAME_POSITION, "127.0.0.1/net"));
elementList.add(EmaFactory.createElementEntry().uintValue(EmaRdm.ENAME_ALLOW_SUSPECT_DATA, 1));
consumer = EmaFactory.createOmmConsumer(EmaFactory.createOmmConsumerConfig().operationModel(OmmConsumerConfig.OperationModel.USER_DISPATCH)
.addAdminMsg(reqMsg.domainType(EmaRdm.MMT_LOGIN).name("user").nameType(EmaRdm.USER_NAME).attrib(elementList)));

There is an example for admin domain configuration at Java/Ema/Examples/src/main/java/com/refinitiv/ema/examples/training/consumer/series400/ex423_MP_AdmDomainCfg_DomainRep

@Daniela-O
Copy link
Author

Hi @soranat, thank you for your reply.
I have a couple questions:

  • in your example you are setting ApplicationName, AppId and Position. Since we are only trying to change the applicationName, we tried setting only that one, but we see in EmaLogs that only ApplicationName is indeed set:
<REQUEST domainType="LOGIN" streamId="1" containerType="NO_DATA" flags="0x04 (STREAMING)" dataSize="0">
    <key flags="0x26 (HAS_NAME|HAS_NAME_TYPE|HAS_ATTRIB)" name="radmin" nameType="1" attribContainerType="ELEMENT_LIST">
        <attrib>
            <elementList flags="0x08 (HAS_STANDARD_DATA)">
                <elementEntry name="ApplicationName" dataType="ASCII_STRING" data="test"/>
                <elementEntry name="Role" dataType="UINT" data="0"/>
            </elementList>
        </attrib>
    </key>
    <dataBody>
    </dataBody>
</REQUEST>

With the default login (i.e. if we do not manually set anything via elementList) all the fields ApplicationName, ApplicationId, Position are set directly by Ema:

<REQUEST domainType="LOGIN" streamId="1" containerType="NO_DATA" flags="0x04 (STREAMING)" dataSize="0">
        <key flags="0x26 (HAS_NAME|HAS_NAME_TYPE|HAS_ATTRIB)" name="ask" nameType="1" attribContainerType="ELEMENT_LIST">
            <attrib>
                    <elementList flags="0x08 (HAS_STANDARD_DATA)">
                        <elementEntry name="ApplicationId" dataType="ASCII_STRING" data="256"/>
                        <elementEntry name="ApplicationName" dataType="ASCII_STRING" data="ema"/>
                            <elementEntry name="Position" dataType="ASCII_STRING" data="10.234.170.22/xcpm1ouas002"/>
                            <elementEntry name="Role" dataType="UINT" data="0"/>
                </elementList>
        </attrib>
</key>
<dataBody>
</dataBody>
</REQUEST>

We see that Ema contains default values for ApplicationId and ApplicationName: "ema" and "256" respectively. Are all those fields necessary or can we go with a Login with only ApplicationName elementEntry? In the first case, how to populate the position field?

  • You are adding the elementList to the Login message like this:
    reqMsg.domainType(EmaRdm.MMT_LOGIN).name("user")
    Is it possible to apply the same when working with RTO? In that case we do not have a username, what should we use to populate the user?
    Removing the user entirely from the Login message doesn't work, and also using clientId as user with RTO does not work.

Thank you

@soranat
Copy link
Contributor

soranat commented Nov 27, 2024

@Daniela-O

You need to encode the entire login attributes that you want including AppId and Position. The OmmConsumerConfig.addAdminMsg() method overrides the default administrative request in EMA. There is a sample code to encode the position field in the ex420_MP_AdmDomainCfg example.

By using default login request, EMA provides the ability to get an access token from the token service using client Id in order to connect with the RTO. This is not possible with the addAdminMsg() which overrides the entire default login request and application needs to get an access token by itself in order to send a login request using the EmaRdm.USER_AUTH_TOKEN name type.

For changing only application name, we can extend the OmmConsumerConfig class to have a method which can override the application name of the default login as same as the OmmConsumerConfig.applicationId() method. So, you don't have to override the entire login request message in order to work with RTO seamlessly.

@Daniela-O
Copy link
Author

Thank you @soranat for your reply.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants