Decoding FieldList Contents with Field and Enumerated Types Dictionaries

It's not very clear from the docs HOW actually I can get decoded value from the dictionary.
For example the following request:
consumer.registerClient(EmaFactory.createReqMsg().domainType(6)
.serviceName("ELEKTRON_EDGE").name("ADDYY.PQ"), appClient);
I receive
FieldEntry fid="15" name="CURRENCY" dataType="Enum" value="840"
How I can programmatically get corresponding value for 840 from enumtype.def dictionary? (840 "USD" US dollar)
Best Answer
-
EMA Java does not provide
interface to get decoded enum value. EMA Java keeps the dictionaries
(RDMFieldDictionary and enumtype.def) internally. However, EMA Java is open
source so you can modify it to get decoded enum value according to the enum
dictionary it has loaded as example shown below:OmmEnum.java– add getEnum() method
public com.thomsonreuters.upa.codec.Enum getEnum();
OmmEnumImpl.java–
implement getEnum() method@Override
public com.thomsonreuters.upa.codec.Enum getEnum()
{
return _rsslEnum;
}FieldEntry.java– add
enumText() methodpublic String enumText();
FieldEntryImpl.java–
implement enumText() to get decoded enum value according to enum dictionary@Override
import com.thomsonreuters.upa.codec.EnumType;
…
public String enumText() {
OmmEnum aEnum= ((OmmEnum)_load);
EnumType enumType =_fieldList._rsslDictionary.entryEnumType(_rsslDictionaryEntry,aEnum.getEnum());
if(enumType==null) {
String errText = errorString().append("Attempt to enumText() while value(" )
.append(String.valueOf(aEnum.enumValue())).append(") is not found in enumtype.def").toString();
throw ommIUExcept().message(errText);
}
else
return enumType.display().toString();
}0
Answers
-
It does not appear EMA supports enumerated types properly, it is possible with ETA.
EnumType enumType = dictionary.entryEnumType(dictionaryEntry, fidEnumValue);
System.out.println (enumType.display().toString());You have the enum value in EMA but the dictionary is completely hidden.
0 -
The example to use enumText() which source code is above:
System.out.print("Fid: " + fieldEntry.fieldId() + " Name = " + fieldEntry.name() + " DataType: " + DataType.asString(fieldEntry.load().dataType()) + " Value: ");
...
case DataTypes.ENUM :
System.out.println(fieldEntry.enumValue() + "(" + fieldEntry.enumText()+")");
break;The example output:
Fid: 15 Name = CURRENCY DataType: Enum Value: 840(USD)
0 -
This is a good way to convert the enum value to text. Wanted to state that the proposed solution goes against the EMA established decoding rules. Throwing exception when the enum text is not found in the dictionary on the decoding path is "frowned upon" due to the Java performance implications. The OmmError class should be used instead. Handling of this situation is tricky since it is unclear what caused the error: network glitch, wrong dictionary, or anything else. Blindly converting the OmmEnum into the OmmError may bring "wrong" consequences to apps that do not care about the enum text.
0 -
the ETA and RFA do provide means for enum value to text conversion. The EMA is planning to add a similar capability too.
0 -
The Elektron SDK team just released a new version ("Elektron SDK - Java - 1.1.0" available for download here) that implements the features you need. The FieldEntry::getEnumDisplay() method gives you access to String representations of Enum values. This new SDK also allows you to get access to the internal EMA dictionary. I did not test these features yet but they seem promising.
0
Categories
- All Categories
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 684 Datastream
- 1.4K DSS
- 613 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
- 248 ETA
- 552 WebSocket API
- 37 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
- 630 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
- 26 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 191 TREP Infrastructure
- 228 TRKD
- 915 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 86 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛