OnixS C++ FIX Engine  3.24.0
API Documentation
Session-level Dictionaries

The dictionary examples, described above, refer to engine-wide dictionaries. This means, that specific dictionaries changes will affect each Engine session with only this FIX protocol dictionary. Nevertheless, sometimes there is a need to use different FIX dictionaries in different FIX sessions within the same engine. The OnixS C++ FIX Engine supports such per session dictionaries in the following manner.

Identifying Session-level Dictionary in Dictionaries Description File

To focus the scope of a dictionary definition from engine-wise to a session level, the dictionary definition must be enhanced with additional attribute id:

<?xml version="1.0" encoding="utf-8"?>
<Dialect xmlns="http://ref.onixs.biz/fix/dialects"
xsi:schemaLocation="http://ref.onixs.biz/fix/dialects http://ref.onixs.biz/fix/dialects/dialects-2_14.xsd">
<!-- Attribute 'id' tells OnixS C++ FIX Engine, in which a dictionary will be used in certain sessions only. It will not be used widely. -->
<FIX version="4.0" id="Custom FIX">
<!-- Regular dictionary description goes here. -->
When the defined dictionary description has non-empty id attribute, then C++ FIX Engine will not use it for all sessions. Instead of this, such a dictionary can be used for specific sessions only.

Referencing to Dictionary in Session

In a source code, an instance of the OnixS::FIX::Dictionary class must be created. Its constructor accepts only one parameter, which identifies the dictionary a user would like to use for the session. The value of this parameter must be the same as in the XML description. Once an instance of OnixS::FIX::Dictionary is created, the FIX session can be initialized. The OnixS::FIX::Session initialization is performed in the usual way with the single difference only: instead of supplying the version of the FIX protocol, the instance of the appropriate Dictionary class must be passed. After that the created session will operate, using specified FIX dictionary.

Dictionary customFIX("Custom FIX");
Session sessionWithCustomFIX("Sender", "Target", customFIX, &defaultListener);

Sending and Receiving Messages

To send messages of certain dictionary, the instance of the OnixS::FIX:Dictionary class must be supplied during Message construction.

Dictionary customFIX("Custom FIX");
Message customOrder("D", customFIX);