question

Upvotes
Accepted
7 3 4 5

How to make my parameter Configurable by taking its value from config file?

Example:

ifstream ricFile("E:\\RicCodeFile.txt");

string ricCode;

OmmArray ricArray;

// read RICS from file into Array

if (ricFile.is_open())

{

while (getline(ricFile, ricCode)) ricArray.addAscii(ricCode.c_str()); ricArray.complete();

ricFile.close();

}

// Encode array into ReqMsg

UInt64 handle = consumer.registerClient( ReqMsg() .serviceName( "IDN_SELECTFEED" ) .payload( ElementList().addArray( ":ItemList", ricArray ).complete() ).interestAfterRefresh(true), client );

---------------------------

Currently I am hard coding file path, service Name, but I want to make it configurable using config file. please help..

elektronrefinitiv-realtimeelektron-sdkrrtema-apielektron-message-apiconfiguration
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

Upvotes
Accepted
7.6k 15 6 9

@nishikarale

As far as I know, currently EMA C++ does not provide interface to read custom configuration from EMA configuration file.

You have to implementation your own configuration using text file or set your config in your application config using xml or json file and then use 3rd party C++ lib to read the file. Other solution might be environment variable which you can read the value from your application using getenv() from standard library. But you have to set the environment variable when you install the application on the new machine.

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.