Configure programmatic config, but specify token manually

Hello,
I am trying to config ema programmatically, previously I was using EmaConfig.xml and in the specifying:
final var config = EmaFactory.createOmmConsumerConfig();
config.consumerName(NAME);
config.addAdminMsg(EmaFactory.Domain.createLoginReq()
.clear()
.name(token)
.nameType(USER_AUTH_TOKEN)
.applicationId("AppId").message());
return EmaFactory.createOmmConsumer(config, loginCallback, errorCallback);
Now I am trying to create programmatic config:
final var elektronHosts = getHosts(token);
final var programmaticConfig = createProgrammaticConfig(elektronHosts, true);
final OmmConsumerConfig config = EmaFactory.createOmmConsumerConfig()
.config(programmaticConfig)
.consumerName("Consumer_1");
config.addAdminMsg(EmaFactory.Domain.createLoginReq()
.clear()
.name(token)
.nameType(USER_AUTH_TOKEN)
.applicationId("AppId").message());
return EmaFactory.createOmmConsumer(config, loginCallback, errorCallback);
But I am getting following error:
Received EMA invalid usage. Text is loggerMsg
ClientName: ChannelCallbackClient
Severity: Error
Text: Failed to add RsslChannel(s) to RsslReactor. Channel name(s)
Instance Name Consumer_1_1
RsslReactor @100ab035
RsslChannel null
Error Id -6
Internal sysError 0
Error Location Reactor.copyOAuthCredentialForSessionManagement
Error Text Failed to copy OAuth credential for enabling the session management; OAuth client ID does not exist.
loggerMsgEnd
This is programmatic config:
private Map createProgrammaticConfig(List<ElektronHost> endpoints, boolean isWebSocket) {
Map configDb = EmaFactory.createMap();
Map elementMap = EmaFactory.createMap();
ElementList elementList = EmaFactory.createElementList();
ElementList innerElementList = EmaFactory.createElementList();
elementList.add(EmaFactory.createElementEntry().ascii("DefaultConsumer", "Consumer_1"));
innerElementList.add(EmaFactory.createElementEntry().ascii("ChannelSet", getChannelSetValue(endpoints.size())));
innerElementList.add(EmaFactory.createElementEntry().ascii("Dictionary", "Dictionary_1"));
//For support regular tracing it should be also enabled.
innerElementList.add(EmaFactory.createElementEntry().intValue("XmlTraceToStdout", 1));
//For support RTT monitoring it should be enabled
innerElementList.add(EmaFactory.createElementEntry().uintValue("EnableRtt", 1));
elementMap.add(EmaFactory.createMapEntry().keyAscii("Consumer_1", 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();
for (int i = 0; i < endpoints.size(); i++) {
innerElementList.add(EmaFactory.createElementEntry().ascii("ChannelType", "ChannelType::RSSL_ENCRYPTED"));
if (isWebSocket) {
innerElementList.add(EmaFactory.createElementEntry().ascii("EncryptedProtocolType", "EncryptedProtocolType::RSSL_SOCKET"));
innerElementList.add(EmaFactory.createElementEntry().ascii("WsProtocols", "tr_json2, rssl.json.v2"));
}
innerElementList.add(EmaFactory.createElementEntry().ascii("Host", endpoints.get(i).getEndpoint()));
innerElementList.add(EmaFactory.createElementEntry().ascii("Port", String.valueOf(endpoints.get(i).getPort())));
innerElementList.add(EmaFactory.createElementEntry().intValue("EnableSessionManagement", 1));
elementMap.add(EmaFactory.createMapEntry().keyAscii("Channel_" + (i + 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::ChannelDictionary"));
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();
return configDb;
}
private String getChannelSetValue(int size) {
final StringBuilder channelBuilder = new StringBuilder();
IntStream.range(1, size)
.forEach(i -> channelBuilder.append("Channel_").append(i).append(", "));
channelBuilder.append("Channel_").append(size);
return channelBuilder.toString();
}
I feel like I am missing something in my programmatic configuration.
What would be the correct way to create programmatic config, while managing the token myself without the ema to manage it for me?
Best Answer
-
We do not currently support allowing you to manage the token manually in EMA.
If you do wish to manage the token manually, it could be possible to do so using raw ETA (non ValueAdd layer) - but I have never tried this.
If you were planning to manually manage the token because you need to share it across multiple processes/applications - please ask your Refintitiv account team to provide you with additional MachineIDs so that each process can use a unique MachineID.
0
Answers
-
Hi @umer.nalla, thank you for your response, I am able to manage token manually when I use EmaConfig.xml, together with
config.addAdminMsg(EmaFactory.Domain.createLoginReq()
.clear()
.name(token)
.nameType(USER_AUTH_TOKEN)
.applicationId("AppId").message());Is the inability to manage token manually only present in programmatical config (because I can manually manage token wtih xml config)?
0 -
Seems like I have figured it out. Sorry mistake on my part, should have set EnableSessionManagement to false during configuration.
innerElementList.add(EmaFactory.createElementEntry().intValue("EnableSessionManagement", 0));
0 -
@Askhat.SerikovHi
Thanks for the update - however, as mentioned above, this is not supported by the RT-SDK team and may break in future versions (according to the RT-SDK dev team).
0 -
I understand, thank you0
-
Hi @Shadab Hussain , done, thanks for remainder
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 685 Datastream
- 1.4K DSS
- 615 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 252 ETA
- 556 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 652 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 228 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛