In real life Sessions FIX Connections occurs at regular intervals. A lot of trading systems have public schedules which declare time frames for trading. Session class exposes members for a FIX Connections basic handling. It also provides users with an automatic reconnection facility in case of the connection failure. However, there is no way in Session functionality to maintain Connections on a systematic basis.
To satisfy the needs of real-life trading schedules, OnixS FIX Engine offers the Sessions Scheduler. This service will automatically connect certain FIX sessions to the counterparty at the beginning of the trading day, as well as disconnect at the end of the day. It is also possible to keep a FIX Session connected for an entire trading week and disconnect it at the end of the last trading day.
The Sessions Scheduler is available as a part of OnixS FIX Engine.
OnixS::FIX::Scheduling::SessionScheduler is a workhorse class of the Sessions Scheduling services. This class exposes a simple, but comprehensive API, to handle connections by schedules of any complexity.
OnixS::FIX::Scheduling::SessionScheduler::add member schedules a session for automatic logon and logout according to the specified session time, which can be delivered to Scheduler as an instance of the appropriate class, or as a name of the predefined preset. The parameter of the type OnixS::FIX::Scheduling::SessionConnectionSettings specifies the role of Session (either Acceptor or Initiator), and primary connection parameters like host and port, which Session will use to establish FIX Connection.
OnixS::FIX::Scheduling::SessionScheduler::remove given session from the scheduling services.
The following steps take place while scheduling Session:
Both attempt settings default to 3, and both intervals default to 180 seconds. The scheduler and Engine settings are independent: changing the Engine values does not change scheduled logon retries.
OnixS::FIX::Scheduling::SessionSchedulerListener reports scheduling warnings and errors, not session errors. Its OnixS::FIX::Scheduling::SessionSchedulerListener::onWarning callback reports non-critical issues, including exceptions thrown by the listener's onLoggingOut and onInitiatorConnecting callbacks. During scheduled initiator logon, the scheduler also calls it after each failed host attempt when more attempts remain.
OnixS::FIX::Scheduling::SessionSchedulerListener::onError reports scheduling errors, including a failed scheduled logout, a failed acceptor logon, or a failed final permitted initiator logon attempt. After such an error, the scheduler makes no further scheduled logon or logout attempts for that session until the next scheduled activity period.
If an attempt already in progress at scheduled logout time fails and it was the final permitted attempt, the scheduler still calls onError.