EMA C++ Configuration Guide : 4 Enterprise Message API Configuration Processing : 4.3 Processing the Enterprise Message API XML Configuration File : 4.3.1 Reading the Configuration File : 4.3.1.2 Using a Custom Filename and/or Directory
 
4.3.1.2 Using a Custom Filename and/or Directory
If you include a path with OmmConsumerConfig, the application creates a filename from the argument and attempts to open a file with that name, as follows:
If the argument represents only a directory, the Enterprise Message API appends EmaConfig.xml to the argument and verifies whether EmaConfig.xml exists in the specified directory.
If the argument represents a directory and filename, the Enterprise Message API verifies whether the specified file exists.
If the specified file does not exist, the application throws an IceException, which indicates the specified path and the current working directory.
If the argument represents neither a file nor a directory, an IceException is thrown.
When the application finds the configuration file, the application processes it and applies the custom configuration to the default configuration. However, other errors can occur during processing such as the following:
The file is empty
The file cannot be opened
Memory cannot be allocated for reading the file
The file cannot be read
The file contains invalid XML
If any of the preceding errors happen, the application throws an IceException, and the text associated with the application will indicate which error occurred.
If you want to specify a custom path and filename, have the application create an OmmConsumerConfig object with the path and filename in the argument (for details on this object, refer to the Enterprise Message API C++ Developers Guide) and pass it to the OmmConsumer object as follows (where PATH is the alternate path and/or filename you want to use for your configuration file):
 
 
OmmConsumerConfig config(PATH);
 
OmmConsumer consumer(config);
 
For an example of how to specify a custom configuration file name, refer to Example 111 (111__MarketPrice__UserSpecifiedFileConfig) included with the package.