Available Configuring Alternatives
To make market data processing happen, the connection settings for the feeds participating in data processing are to be defined. There're two ways to supply connectivity information to the Handler.
The first one supposes explicit update of the corresponding parameters for each of the feeds used by the Handler during the market data processing session. The second way allows to retrieve connection data from a connectivity configuration file published by CME. The following sections uncovers boths ways in details.
Setting up Connection Parameters Explicitly
All parameters defining the feed connection are gathered into the OnixS::CME::MDH::FeedConnectionSettings class. The primary attributes are:
- The ID parameter represents a unique feed identifier and accessed by the OnixS::CME::MDH::FeedConnectionSettings::id members.
- The IP address of a multicast group to join or a remote host to connect to. Empty value for the given parameter indicates whether the connection is defined for the feed or not. Access to the value of the given parameter can be done through the OnixS::CME::MDH::FeedConnectionSettings::ip members.
- The port number of a remote connection or multicast group. Access to the parameter is provided by the OnixS::CME::MDH::FeedConnectionSettings::port members.
- The hosts parameter serves to supply additional information on the connection. For example, it represents a list of remote hosts performing actual market data transmission for multicast feeds. In case of TCP connection, the given parameter may identify a remote host to connect to (instead of IP address). For example, CME uses the given parameter instead of the IP adress parameter while defining connection attributes for the feeds in the connectivity configuration file. The parameter can be accessed through the OnixS::CME::MDH::FeedConnectionSettings::hosts members.
- The network interfaces parameter lets to define network interfaces on which the feed engine will listen to market data comming from the correspondent feed.
The OnixS::CME::MDH::FeedSettingsBase template class includes two members, OnixS::CME::MDH::FeedSettingsBase::A and OnixS::CME::MDH::FeedSettingsBase::B, exposing connection-related settings for the primary (A) and secondary (B) feed correspondently.
The master OnixS::CME::MDH::FeedSettings class exposes instances of settings referring to a particular feed type (instrument, incremental, snapshot, etc). All type-specific feed settings are derived from the mentioned OnixS::CME::MDH::FeedSettingsBase template class. Thus all feed connection settings can be manipulated in a uniform way.
The code snippet below depicts how to manually specify connectivity parameters for the primary (A) incremental feed:
Handler handler;
FeedConnectionSettings&
feedConnection =
handler.
settings().
feeds().
incrementalFeed().
A();
feedConnection.id("310IA");
feedConnection.ip("224.0.0.28");
feedConnection.port(15310);
#if !defined (_WIN32)
feedConnection.networkInterfaces("eth0;eth1");
#endif
Loading Connectivity Configuration from a File
The CME publishes all connection-related information in a XML-formatted file.
The SDK offers the new OnixS::CME::MDH::connectivityFromConfiguration function allowing connection parameters retrieval from the noted connectivity configuration file. The function extracts data for all feeds belonging to a particular channel and updates correspondent parameters of the given OnixS::CME::MDH::FeedSettings class instance.
Also, the OnixS::CME::MDH::FeedSettings class includes OnixS::CME::MDH::FeedSettings::connectivityConfigurationFile member which supposes specifying path to the connectivity configuration file instead of manual setup. Once set, the Handler will load connection settings from the specified file.
- Note
- The connectivity configuration file includes following attributes of the feed connection: id, ip, port, and hosts. Information on network interfaces is environment-specific and thus isn't stored in the file. Therefore, the network interfaces must be defined explicitly using the correspondent members.
- Warning
- The OnixS::CME::MDH::FeedSettings::connectivityConfigurationFile parameter has lower priority comparing to the manual and explicit update of connection-related parameters. That means, the Handler will ignore loading connection settings from the specified configuration file if connection settings were manually defined. Instead, feed connection settings will be used by the Handler while initializing market data processing session.
Selecting Data Center
CME maintains additional data centers to be used in special cases like a disaster. Information on how to connect to a specific data source belonging to a specific data center is also included into in the configuration file. Therefore, both the OnixS::CME::MDH::connectivityFromConfiguration and the OnixS::CME::MDH::FeedSettings::connectivityConfigurationFile functions include additional parameter that allows choosing which datacenter connection settings to use.
Handler handler;
handler.
settings().
connectivityConfigurationFile
(
"config.xml",
DataCenter::DisasterRecovery
);