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 -
Hi @Askhat.Serikov
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 you @umer.nalla0
-
Hi @Shadab Hussain , done, thanks for remainder
0
Categories
- All Categories
- 6 AHS
- 37 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛