How to use RDMFieldDictionary using EMA java API ?

Hi,

I'm specifying the field ids of fields I'm interested for a list of RICs as below.

OmmArray fieldAarray = EmaFactory.createOmmArray();
fieldAarray.fixedWidth(2);
fieldAarray.add(EmaFactory.createOmmArrayEntry().intValue(22)); //BID
fieldAarray.add(EmaFactory.createOmmArrayEntry().intValue(25)); // ASK

I believe I need to use the RDMFieldDictionary to get the field id of an field instead of hard-coding the same in the code. I'm not able to find any sample code. Can you please point to a sample that demonstrates how to use RDMFieldDictionary using Java EMA api ?

I'm sorry if it is already there and I didn't look properly.

Thanks in advance.

Mani

Best Answer

  • @Mani.A

    You can load the data dictionary from the local files (RDMFieldDictionary and enumtype.def) by using the following code.

            DataDictionary dataDictionary = EmaFactory.createDataDictionary();
            dataDictionary.loadFieldDictionary("RDMFieldDictionary");
            dataDictionary.loadEnumTypeDictionary("enumtype.def");
            System.out.println(dataDictionary.entry("BID").fid());

    Those files are available in the <RTSDK_PATH>\Java\etc directory and GitHub.

    You can also download the data dictionary from the connected server. For the sample code, please refer to the ex332_Dictionary_Streaming.

Answers

  • Thank you @jirapongse.phuriphanvichai. It worked after I gave relative/full path to the dictionary files.

    Is there a way to load these files from CLASSPATH ?

    Or even better how can load these from the Dictionary entries specified in the EmaConfig.xml ?

    In the EmaConfig.xml
    <Dictionary>
    <Name value="Dictionary_2"/>
    <DictionaryType value="DictionaryType::FileDictionary"/>
    <RdmFieldDictionaryFileName value="./etc/RDMFieldDictionary"/>
    <EnumTypeDefFileName value="./etc/enumtype.def"/>
    </Dictionary>

    Thank you in advance.

    Mani