OnixS C++ FIX Engine  4.10.1
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:

1 <?xml version="1.0" encoding="utf-8"?>
2 <Dialect xmlns="https://ref.onixs.biz/fix/dialects"
3  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4  xsi:schemaLocation="https://ref.onixs.biz/fix/dialects https://ref.onixs.biz/fix/dialects/dialects-2.15.xsd">
5 
6  <FIX version="4.0" id="Custom FIX">
7 
8  </FIX>
9 </Dialect>
Note
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, &listener);

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);
fillCustomFIXOrder(&customOrder);
customOrder.validate();