OnixS C++ FIX Engine  4.11.0
API Documentation

Session Scheduler exposes the OnixS::FIX::Scheduling::SessionConnectionSettings class to define the FIX connection related parameters, required to establish FIX Session successfully. Two primary descendants, OnixS::FIX::Scheduling::AcceptorConnectionSettings and OnixS::FIX::Scheduling::InitiatorConnectionSettings classes, are targeted to provide users with a handy way of defining connection-related parameters for sessions-acceptors and sessions-initiators appropriately.

Defining Connection Settings for Sessions-Acceptors

The only parameter, related to establishing FIX session as acceptor, is a number of TCP port on the local machine. Since this parameter is defined at the Engine initialization stage, there's nothing to require for Scheduler from the user to establish the FIX session in the role of an acceptor. Therefore, the fact session must be established as the acceptor is determined by the constructing parameter less than an instance of the OnixS::FIX::Scheduling::AcceptorConnectionSettings class.

Example

using namespace OnixS::FIX::Scheduling;
void registerSessionAsAcceptor(Session* session, SessionScheduler& scheduler, const SessionSchedule& schedule)
{
scheduler.add(session, schedule, AcceptorConnectionSettings());
}

Defining Connection Settings for Sessions-Initiators

When a session is logged on in the role of an initiator, at least hostname and TCP port of the counterparty must be specified. For this reason, all constructors of the OnixS::FIX::Scheduling::InitiatorConnectionSettings class require counterparty hostname and TCP port parameters.

InitiatorConnectionSettings basicSettings("localhost", 4500);

Sometimes a session's counterparty may be out of service, causing session logon failure. Some systems provide secondary servers, which can be connected while primary servers are down. To support such cases, OnixS::FIX::Scheduling::InitiatorConnectionSettings class exposes the OnixS::FIX::Scheduling::InitiatorConnectionSettings::addCounterparty member, which allows defining secondary servers, that will be connected in case of the connection failure to the primary server. Also, Scheduler remembers last good connection settings (counterparty). Therefore, since the next time connection must be established, it will use the last good configuration.

InitiatorConnectionSettings settingsWithSecondaryServer("primary.domain.com", 4500);
settingsWithSecondaryServer.addCounterparty("secondary.domain.com", 4600);

In addition to primary counterparty settings, the OnixS::FIX::Scheduling::InitiatorConnectionSettings class allows specifying difference to default the value of a heartbeat interval, required to properly maintain the FIX session. It's also possible to include the SetResetSequenceNumbers flag into standard logon message. One of the constructors of the OnixS::FIX::Scheduling::InitiatorConnectionSettings class has the resetSessionSequenceNumbers boolean parameter, which controls whether session message sequence numbers must be reset duringlogon procedure.

Finally, OnixS::FIX::Scheduling::InitiatorConnectionSettings class constructors accept instance of the OnixS::FIX::Message class to be used as a custom Logon message.