The Session Scheduler exposes OnixS::FIX::Scheduling::SessionConnectionSettings class to define FIX connection related parameters required to successfully establish FIX Session. Two primary descendants, OnixS::FIX::Scheduling::AcceptorConnectionSettings and OnixS::FIX::Scheduling::InitiatorConnectionSettings classes, are targeted to provide users with handy way of defining connection-related parameters for sessions-acceptors and sessions-initiators appropriately.
The only parameter related with 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 the Scheduler from the user to establish FIX session in role of acceptor. Therefore, the fact session must be established as an acceptor is determined by constructing parameterless instance of OnixS::FIX::Scheduling::AcceptorConnectionSettings class.
using namespace OnixS::FIX::Scheduling; void registerSessionAsAcceptor(Session* session, const SessionSchedule& schedule) { scheduler.add(session, schedule, AcceptorConnectionSettings()); }
When session is logged on in role of initiator, at least host name and TCP port of the counterparty must be specified. For this reason all constructors of OnixS::FIX::Scheduling::InitiatorConnectionSettings class require counterparty host name and TCP port parameters.
InitiatorConnectionSettings basicSettings("localhost", 4500);
Sometimes 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 OnixS::FIX::Scheduling::InitiatorConnectionSettings::addCounterparty member which allows defining secondary servers which will be connected in case of connection failure to the primary server. Also, Scheduler remembers last good connection settings (counterparty). Therefore, next time connection must be established, it will use last good configuration.
InitiatorConnectionSettings settingsWithSecondaryServer("primary.domain.com", 4500); settingsWithSecondaryServer.addCounterparty("secondary.domain.com", 4600);
In addition to primary counterparty settings, OnixS::FIX::Scheduling::InitiatorConnectionSettings class allows to specify different to default value of a heartbeat interval, required to properly maintain FIX session.
It's also possible to include SetResetSequenceNumbers
flag into standard logon message. One of constructors of OnixS::FIX::Scheduling::InitiatorConnectionSettings class has resetSessionSequenceNumbers
boolean parameter which controls whether session message sequence numbers must be reset during logon procedure.
Finally, OnixS::FIX::Scheduling::InitiatorConnectionSettings class constructors accept instance of OnixS::FIX::Message class to be used as custom Logon message.