Elecktron programtic config

std::stringstrSeverName("Server01");

MapinnerMap;

ElementListelementList;

// ConsumerGroup

elementList.addAscii( "DefaultConsumer", "Consumer_1" );

innerMap.addKeyAscii( "Consumer_1", MapEntry::AddEnum, ElementList()

.addAscii( "ChannelSet", "Channel_1,Channel_2" )

.addAscii( "Logger", "Logger_1" )

.addAscii( "Dictionary", "Dictionary_1" )

.addUInt( "ItemCountHint", 5000 )

.addUInt( "ServiceCountHint", 5000 )

.addUInt( "ObeyOpenWindow", 0 )

.addUInt( "PostAckTimeout", 5000 )

.addUInt( "RequestTimeout", 5000 )

.addUInt( "MaxOutstandingPosts", 5000 )

.addInt( "DispatchTimeoutApiThread", 1 )

.addUInt( "HandleException", 0 )

.addUInt( "MaxDispatchCountApiThread", 500 )

.addUInt( "MaxDispatchCountUserThread", 500 )

.addInt( "ReactorEventFdPort", 45000 )

.addInt( "PipePort", 4001 ).complete() ).complete();

elementList.addMap( "ConsumerList", innerMap );

elementList.complete();

innerMap.clear();

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

elementList.clear();

// ChannelGroup

innerMap.addKeyAscii( "Channel_2", MapEntry::AddEnum, ElementList()

.addEnum( "ChannelType", 0 )

.addAscii( "InterfaceName", strSeverName.c_str() )

.addEnum( "CompressionType", 0) // 0 none compression

.addUInt( "GuaranteedOutputBuffers", 5000 )

.addUInt( "ConnectionPingTimeout", 50000 )

.addInt( "ReconnectAttemptLimit", 10)

.addInt( "ReconnectMinDelay", 2000 )

.addInt( "ReconnectMaxDelay", 6000 )

.addAscii( "Host", strSeverName.c_str() )

.addAscii( "Port", "14002" )

.addUInt( "TcpNodelay", 1 ) // 1 mean no delay, 0 mean Nagle’s algorithm

.addUInt( "XmlTraceToFile", 0 ) // 0 : Turns off tracing, 1: Turns on tracing to an XML file.

.addUInt( "MsgKeyInUpdates", 1 ).complete());

innerMap.addKeyAscii( "Channel_1", MapEntry::AddEnum, ElementList()

.addEnum( "ChannelType", 0 )

.addAscii( "Host", strSeverName.c_str() )

.addAscii("Port", "14002" ).complete() ).complete();

elementList.addMap( "ChannelList", innerMap );

elementList.complete();

innerMap.clear();

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

elementList.clear();

// LoggerGroup

innerMap.addKeyAscii( "Logger_1", MapEntry::AddEnum,

ElementList()

.addEnum( "LoggerType", 1 ) // 1 is stdout

.addEnum( "LoggerSeverity", 1 ).complete() );

innerMap.addKeyAscii( "Logger_2", MapEntry::AddEnum,

ElementList()

.addEnum( "LoggerType", 0 )

.addAscii( "FileName", "logFile" )

.addEnum( "LoggerSeverity", 1 ).complete() ).complete();

elementList.addMap( "LoggerList", innerMap );

elementList.complete();

innerMap.clear();

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

elementList.clear();

//DictionaryGroup

innerMap.addKeyAscii( "Dictionary_1", MapEntry::AddEnum,

ElementList()

.addEnum( "DictionaryType", 1).complete());

innerMap.addKeyAscii( "Dictionary_2", MapEntry::AddEnum,

ElementList()

.addEnum( "DictionaryType", 0)

.addAscii( "RdmFieldDictionaryFileName", "./RDMFieldDictionary" )

.addAscii( "EnumTypeDefFileName", "./enumtype.def" ).complete() ).complete();

elementList.addMap( "DictionaryList", innerMap );

elementList.complete();

m_ConfigMap.addKeyAscii( "DictionaryGroup", MapEntry::AddEnum, elementList );

elementList.clear();

m_ConfigMap.complete();

/////////////////////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////////////////////

error message is here, both logger_1 and Dictionary_1 is failed, why?

loggerMsg TimeStamp: 15:17:54.885 ClientName: EmaConfig Severity: Error Text: no configuration exists for consumer dictionary [DictionaryGroup|Di ctionaryList|Dictionary.Dictionary_1|]; will use dictionary defaults loggerMsgEnd

loggerMsg TimeStamp: 15:17:54.886 ClientName: EmaConfig Severity: Error Text: no configuration exists for consumer logger [LoggerGroup|LoggerList |Logger.Logger_1|]; will use logger defaults loggerMsgEnd

Best Answer

  • If I paste an EmaConfig.xml file which contains only empty "Logger_1" and "Dictionary_1" node, the error message will not be logged. I believe that the errors are generated when EMA try to load the nodes from the EmaConfig.xml file which doesn't exist. The programmatic configuration should still work correctly, even though these error are generated.

    The EmaConfig.xml file I use is below. If you would like to try the file in your application, the additional nodes should be added for "Logger_2" and "Dictionary_2".

    <?xml version="1.0" encoding="UTF-8"?>
    <EmaConfig>
    <LoggerGroup>
    <LoggerList>
    <Logger>
    <Name value="Logger_1"/>
    </Logger>
    </LoggerList>
    </LoggerGroup>
    <DictionaryGroup>
    <DictionaryList>
    <Dictionary>
    <Name value="Dictionary_1"/>
    </Dictionary>
    </DictionaryList>
    </DictionaryGroup>
    </EmaConfig>

Answers

  • Even I use the same code in 4.4.3

    Example: Programmatic Configuration

    still get the same error message.

    Would someone help to repeat that? thanks.

  • There is a forum for Elektron. If you move this question there using the cog icon top right, it will be answered faster.

  • 421__MarketPrice__ProgrammaticConfig

    have the same problems.

  • I have found the same errors in logger with the 421__MarketPrice__ProgrammaticConfig application, even though the Logger and Dictionary configurations are configured properly. I will investigate the issue further and let you know the result.

  • Thanks for explaining that. that message should be a warning message with more details what happening. hopefully that will be in next realease.

    btw, I am assuming EmaConfig.xml overwrite programmaticConfig, is that right?

  • The programmatic config should override the parameters configured in EmaConfig.xml file. Please see the screenshot of the EMA Configuration Guide document for reference.

    image