Sessions Scheduler
The Sessions Scheduler service cat automatically connect sessions to the counterparty at the beginning of the trading week/day, keep a session connected for the entire trading week/day, and disconnect it at the end of the last trading week/day.
SessionScheduler class
The OnixS::CME::iLink3::Scheduling::SessionScheduler is the main class of the Sessions Scheduling services.
Registering a Session for Automatic Connection
The OnixS::CME::iLink3::Scheduling::SessionScheduler::add member schedules a session for automatic logon and logout according to the specified session time, that can be given to the Scheduler as an instance of the OnixS::CME::iLink3::Scheduling::SessionSchedule class, or as an id of the predefined schedule.
The OnixS::CME::iLink3::Scheduling::SessionConnectionSettings argument specifies the connection settings.
- Note
- If the session is being registered between the scheduled logon and logout time, the Scheduler will connect the session immediately.
Removing Session from Scheduler
The OnixS::CME::iLink3::Scheduling::SessionScheduler::remove method removes the given session from the scheduling services.
- Note
- OnixS::CME::iLink3::Scheduling::SessionScheduler::remove does not disconnect an active session. Therefore, if the session has already been connected by the Scheduler, it remains connected after unregistering.
Handling Scheduling Warnings and Errors
The Scheduler exposes the OnixS::CME::iLink3::Scheduling::SessionSchedulerListener class to notify about errors in the session schedule.
The Scheduler calls the OnixS::CME::iLink3::Scheduling::SessionSchedulerListener::onWarning member to notify about non-critical issues.
Scheduling Rules
- If the session is registered between the scheduled logon and logout time, the Scheduler will connect the session immediately.
- If the session is registered after the logout and before the logon time, the Scheduler will make no attempts to connect the session until the next logon time.
- If the session is registered after the logout and before the logon time, and the session is in an active state, it will be disconnected immediately.
- In case of a logon failure, the Scheduler tries to logon again per its reconnection settings (OnixS::CME::iLink3::Scheduling::SessionScheduler::reconnectAttempts and OnixS::CME::iLink3::Scheduling::SessionScheduler::reconnectInterval).
- In the Handler detects a network error, it tries to restore the connection per the Session configuration (OnixS::CME::iLink3::Session::reconnectAttempts and OnixS::CME::iLink3::Session::reconnectInterval).
- In the exchange disconnect the session during the active windows, the Scheduler tries to connect the session again immediately without delay.
- If the Scheduler connects the session within reconnection attempts defined by the Session configuration, it does not report an error.
- If the session is still in the OnixS::CME::iLink3::SessionStateId::Reconnecting state and the logout time is reached, the Scheduler will stop the reconnect attempts, and will not report an error.
- If the session remains disconnected after all reconnect attempts, the OnixS::CME::iLink3::Scheduling::SessionSchedulerListener::onError method will be called.
- Once the Scheduler calls the OnixS::CME::iLink3::Scheduling::SessionSchedulerListener::onError method, it stops all attempts to connect the session until the next logon time.
Example
std::string host = "";
int port = 0;
Session session(settings, 1,
nullptr);
scheduler.add(&session, sessionSchedule, sessionConnectivity);
- See also
- the Session Scheduler Sample.