How to create pre-configured FIX sessions

Overview

The feature is available since FIX Antenna 2.25.1 release

The feature allows passing a session configuration through the file.

The scenario below describes the case when the application gets all configured sessions from the properties file and iterates over the sessions list and creates them.

With this scenario, all initiator sessions connect immediately to the counterparty.

FIX Antenna C++ code example

application.cpp
/* FixAntenna initialization here */
//....
Engine::Application MyAppAcceptor;
Engine::Application MyAppIntiator;
//....
std::vector<Session*> sessionsVector;
FAProperties::ConfiguredSessionsMap sessions = FixEngine::singleton()->getProperties()->getConfiguredSessions();
for(FAProperties::ConfiguredSessionsMap::const_iterator it = sessions.begin(); it != sessions.end(): ++it)
{
    Session *pSsn;
    if(it->second.sessionRole_ == Engine::INITIATOR_SESSION_ROLE)
        pSsn = FixEngine::singleton()->createSession( &MyAppIntiator, it->first, NA, &it->second );
    else
        pSsn = FixEngine::singleton()->createSession( &MyAppAcceptor, it->first, NA, &it->second );
    pSsn->connect();
    sessionsVector.push_back(pSsn);
}
//....
for(std::vector<Session*>.const_iterator it = sessionsVector.begin(); it != sessionsVector.end(); ++it)
{
    it->release();
}
/* FixAntenna de-initialization here */

FIX Antenna .NET code example

application.cs
/* FixAntenna initialization here */
// ....
List<Session> activeSessions;
Dictionary<SessionId, SessionExtraParameters> sessions = FixEngine.Instance.getConfiguredSessions(SessionRole.NA);
foreach (KeyValuePair<SessionId, SessionExtraParameters> session in sessions)
{
    Session ses = FixEngine.Instance.CreateSession(session.Key, FixVersion.NA, session.Value);
    ses.Connect();
	activeSessions.add(ses);
}
//....
foreach (Session session in activeSessions)
{
	sessions.Dispose();
}

/* FixAntenna de-initialization here */