Description
In earlier versions of FIX Antenna (2.10.14 and earlier) any session object could be uniquely identified by SenderCompId/TargetCompId pair.There were number of methods in external interface of FIX Antenna (like Engine::createSession) which took SenderCompId and TargetCompId parameters to identify session.
...
In this example all sessions except "Sender1/Target1" will pass Session Qualifier as tag 9012 in Logon message.
Table of Contents
Example
To establish several sessions with the same SenderCompId and TargetCompId, both Initiator and Acceptor should create several session objects which differ from each other by SessionQualifier property.
SessionQualifier property on Initiator side must be the same as SessionQualifier property of the corresponding session on acceptor side.
If you do not want an Initiator to pass the Session Qualifier in Logon message, you need to set the property for the Initiator:
Code Block | ||
---|---|---|
| ||
Engine::SessionExtraParameters params;
params.logonMessageSessionQualifierTag_ = 0; |
If you want your Initiator to pass the SenderSubId (50) in messages, you need to set the property for the Initiator.
Code Block | ||
---|---|---|
| ||
params.pSenderSubID_ = "YourSenderSubID"; |
Below is the code snippet that demonstrates how to do it.
Code Block | ||
---|---|---|
| ||
namespace
{
const char Acceptor2Name[] = "Acceptor2";
const char InitiatorName[] = "Initiator";
const char Q1[] = "1"; //Session Qualifier
const char Q2[] = "2"; //Session Qualifier
const char* LISTENER_IP = "127.0.0.1";
const int LISTENER_PORT = 9026;
class InitiatorApp :
public Engine::Application
{
//implementation
};
}
...
int main() {
//init engine
Engine::FixEngine::init("engine.properties");
//...
Engine::SessionExtraParameters params;
params.logonMessageSessionQualifierTag_ = 0;
params.pSenderSubID_ = "SenderSubID_1";
// create two initiator sessions corresponding to the registered acceptor sessions and establish connections
InitiatorApp app1, app2;
Engine::Session* ps1 = Engine::FixEngine::singleton()->createSession( &app1, Engine::SessionId(InitiatorName, Acceptor2Name, Q1), Engine::FIX44, ¶ms);
ps1->connect( 30, LISTENER_IP, LISTENER_PORT );
params.pSenderSubID_ = "SenderSubID_2";
Engine::Session* ps2 = Engine::FixEngine::singleton()->createSession( &app2, Engine::SessionId(InitiatorName, Acceptor2Name, Q2), Engine::FIX44, ¶ms);
ps2->connect( 30, LISTENER_IP, LISTENER_PORT );
//...
} |
As the result of running such code, following Logon messages will be sent:
Session Initiator/Acceptor2/SenderSubID_1:
Code Block |
---|
8=FIX.4.4|9=90|35=A|49=Initiator|56=Acceptor2|34=1|50=SenderSubID_1|52=20170926-15:56:45.237|98=0|108=30|10=113|
|
Session Initiator/Acceptor2/SenderSubID_2:
Code Block |
---|
8=FIX.4.4|9=90|35=A|49=Initiator|56=Acceptor2|34=1|50=SenderSubID_2|52=20170926-15:56:45.284|98=0|108=30|10=116| |
Sample
The SessionQualifier sample application can be found in FA C++ package under "samples" directory.
...
To run sample just enter "sample/SessionQualifier/bin" directory and start run_*.bat on Windows or run.sh on Linux. To run debug version use corresponding command files with letter 'D' at the end. Note, the debug binaries are not included in the package, user needs to build them before running.
...