question

Upvotes
Accepted
3 0 0 2

C++ API Dictionary programmatic setup

Greetings! I am using latest RTSDK C/CPP 2.1.3.G1 aka EMA/ETA 3.7.3.G1 aka 3.7.3.3 and having dictionary timeout issues similar to https://community.developers.refinitiv.com/questions/95787/emadictionary-retrieval-failed-timed-out-after-wai.html

I increased timeout up to 120 seconds, and it helped only once, while most of the time I am having timeout anyway, so I tried to modify config to use local dictionary files. I am preparing config programmatically, so in the code it looks like the following:

void createProgramaticConfig(Map& configDb, const EmaString& aHost, const EmaString& aPort) {
    Map elementMap;
    ElementList elementList;

    elementMap.addKeyAscii("Consumer_1", MapEntry::AddEnum,
        ElementList()
        .addAscii("Channel", "Channel_1")
        .addAscii("Logger", "Logger_1")
        .addAscii("Dictionary", "Dictionary_1")
        .complete()).complete();
    elementList.addMap("ConsumerList", elementMap);
    elementList.complete();
    elementMap.clear();

    configDb.addKeyAscii("ConsumerGroup", MapEntry::AddEnum, elementList);
    elementList.clear();

    //----------------

    Map dictMap;
    dictMap.addKeyAscii("Dictionary_1", MapEntry::AddEnum,
        ElementList()
        .addAscii("Name", "Dictionary_1")
        .addAscii("DictionaryType", "DictionaryType::FileDictionary")
        .addAscii("RdmFieldDictionaryFileName", "./elektron/RDMFieldDictionary")
        .addAscii("EnumTypeDefFileName", "./elektron/enumtype.def").complete()).complete();
    ElementList dictList;
    dictList.addMap("DictionaryList", dictMap);
    dictList.complete();
    configDb.addKeyAscii("DictionaryGroup", MapEntry::AddEnum, dictList);

    //----------------
    elementMap.addKeyAscii("Logger_1", MapEntry::AddEnum,
        ElementList()
        .addEnum("LoggerType", 0)
        .addAscii("FileName", "logFile")
        .addEnum("LoggerSeverity", 0).complete()).complete();
    elementList.addMap("LoggerList", elementMap);
    elementList.complete();
    elementMap.clear();

    configDb.addKeyAscii("LoggerGroup", MapEntry::AddEnum, elementList);
    elementList.clear();

    //----------------

    ElementList channelElementList;
    channelElementList
        .addEnum("ChannelType", 1) // Use the RSSL_CONN_TYPE_ENCRYPTED connection
        .addAscii("Host", aHost)
        .addAscii("Port", aPort)
        .addUInt("EnableSessionManagement", 1);

    channelElementList.addEnum("EncryptedProtocolType", 1); //RSSL_CONN_TYPE_ENCRYPTED
    channelElementList.complete();

    elementMap.addKeyAscii("Channel_1", MapEntry::AddEnum, channelElementList);
    elementMap.complete();
    elementList.addMap("ChannelList", elementMap);
    elementList.complete();

    configDb.addKeyAscii("ChannelGroup", MapEntry::AddEnum, elementList);

    configDb.complete();
}

Once config is made, I am printing it to the log, to ensure it has valid structure:

MapEntry  action="Add" key dataType="Ascii" value="ConsumerGroup" dataType="ElementList"
    ElementList
        ElementEntry name="ConsumerList" dataType="Map"
            Map
                MapEntry action="Add" key dataType="Ascii" value="Consumer_1" dataType="ElementList"
                    ElementList
                        ElementEntry name="Channel" dataType="Ascii" value="Channel_1"
                        ElementEntry name="Logger" dataType="Ascii" value="Logger_1"
                        ElementEntry name="Dictionary" dataType="Ascii" value="Dictionary_1"
                        ElementEntry name="DictionaryRequestTimeOut" dataType="UInt" value="120000"
                    ElementListEnd
                MapEntryEnd
            MapEnd
        ElementEntryEnd
    ElementListEnd
MapEntryEnd

MapEntry  action="Add" key dataType="Ascii" value="DictionaryGroup" dataType="ElementList"
    ElementList
        ElementEntry name="DictionaryList" dataType="Map"
            Map
                MapEntry action="Add" key dataType="Ascii" value="Dictionary_1" dataType="ElementList"
                    ElementList
                        ElementEntry name="Name" dataType="Ascii" value="Dictionary_1"
                        ElementEntry name="DictionaryType" dataType="Ascii" value="DictionaryType::FileDictionary"
                        ElementEntry name="RdmFieldDictionaryFileName" dataType="Ascii" value="./elektron/RDMFieldDictionary"
                        ElementEntry name="EnumTypeDefFileName" dataType="Ascii" value="./elektron/enumtype.def"
                    ElementListEnd
                MapEntryEnd
            MapEnd
        ElementEntryEnd
    ElementListEnd
MapEntryEnd

MapEntry  action="Add" key dataType="Ascii" value="LoggerGroup" dataType="ElementList"
    ElementList
        ElementEntry name="LoggerList" dataType="Map"
            Map
                MapEntry action="Add" key dataType="Ascii" value="Logger_1" dataType="ElementList"
                    ElementList
                        ElementEntry name="LoggerType" dataType="Enum" value="0"
                        ElementEntry name="FileName" dataType="Ascii" value="logFile"
                        ElementEntry name="LoggerSeverity" dataType="Enum" value="0"
                    ElementListEnd
                MapEntryEnd
            MapEnd
        ElementEntryEnd
    ElementListEnd
MapEntryEnd

MapEntry  action="Add" key dataType="Ascii" value="ChannelGroup" dataType="ElementList"
    ElementList
        ElementEntry name="ChannelList" dataType="Map"
            Map
                MapEntry action="Add" key dataType="Ascii" value="Channel_1" dataType="ElementList"
                    ElementList
                        ElementEntry name="ChannelType" dataType="Enum" value="1"
                        ElementEntry name="Host" dataType="Ascii" value="us-east-1-aws-3-med.optimized-pricing-api.refinitiv.net"
                        ElementEntry name="Port" dataType="Ascii" value="14002"
                        ElementEntry name="EnableSessionManagement" dataType="UInt" value="1"
                        ElementEntry name="EncryptedProtocolType" dataType="Enum" value="1"
                    ElementListEnd
                MapEntryEnd
            MapEnd
        ElementEntryEnd
    ElementListEnd
MapEntryEnd

However, this dictionary config is being ignored, and app is trying to request dictionary anyway. Log file attached: logFile_11052.txt


Probably, config is a bit wrong? However, I made it according to examples, and not able to find mistakes there. Could anybody assits, please?

Also, is it normal to experience such a big timeouts for dictionary requests from server?

#technologyema-apic++elektron-data-dictionaryommconsumer
logfile-11052.txt (40.6 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvote
Accepted
25.2k 57 17 14

Hello @konstantin.utkin.cpp

Thank you for reaching out to us. I checked the EMA C++ Cons421 and Cons450 (the connectWebSocket part which requires a local dictionary setting) example codes. They set the Dictionary Type with addEnum() method, not addAscii() method as follows:

    innerMap.addKeyAscii( "Dictionary_1", MapEntry::AddEnum,
        ElementList()
        //.addEnum( "DictionaryType", 1 ) // Use ChannelDictionaryEnum
        .addEnum("DictionaryType", 0) // Use FileDictionaryEnum
        .addAscii( "RdmFieldDictionaryFileName", "C:\\drive_d\\Project\\APIs\\RTSDK_CPP\\RTSDK-2.1.3.L1.win.rrg\\Cpp-C\\etc\\RDMFieldDictionary" )
        .addAscii( "EnumTypeDefFileName", "C:\\drive_d\\Project\\APIs\\RTSDK_CPP\\RTSDK-2.1.3.L1.win.rrg\\Cpp-C\\etc\\enumtype.def" ).complete() ).complete();

I did a quick test on my end with EMA 2.1.3 RRG, and it works file. The trace file shows that it downloaded dictionary from my local machine, not the ADS server.


icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Hello @wasin.w it worked, thank you very much! Didn't noticed this in examples.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.