Programming Guide

Introduction

The Session Scheduler service provides an automated way to manage session connectivity according to predefined trading schedules.
It connects sessions to their counterparties at the beginning of a trading day or week, keeps them connected during active hours, and disconnects them at the end of the trading period.

While the biz.onixs.cme.ilink3.handler.Session object offers basic connection management and automatic reconnection on failures, it does not maintain connections systematically according to trading calendars.
The scheduler fills this gap, ensuring sessions follow real-world exchange connectivity requirements.

Main Class

The biz.onixs.cme.ilink3.scheduler.SessionScheduler class is the core component of the scheduling service.
It provides a high-level API for managing connections according to trading schedules of any complexity.

Registering a Session

The biz.onixs.cme.ilink3.scheduler.SessionScheduler.register(Session, SessionSchedule, SessionConnection) method registers a session for automatic logon and logout according to a specified schedule.

Note:
If a session is registered during a time that falls within its active period, the scheduler connects the session immediately.

Unregistering a Session

The biz.onixs.cme.ilink3.scheduler.SessionScheduler.unregister(Session) method removes the specified session from the scheduler.

Note:
Unregistering a session does not disconnect an active connection. If the session was connected by the scheduler, it will remain connected until explicitly logged out.

Error Notification

The scheduler supports the biz.onixs.cme.ilink3.scheduler.ErrorListener interface for error handling and notifications.
Listeners can subscribe to receive error callbacks when connection or scheduling issues occur.

Scheduler Algorithm

The scheduler’s behavior can be described by the following simplified algorithm:

  1. Determine Active Sessions
    Evaluate the registered schedules to determine which sessions should be active based on the current date and time.

  2. Connect Sessions
    For each session whose schedule indicates an active period:

    • If the session is disconnected, attempt to connect.
    • If a connection attempt fails, retry according to the retry policy defined in the session connection settings.
  3. Maintain Connections
    Keep each active session connected for its entire scheduled duration.
    The scheduler monitors connection states and automatically reconnects if a disconnection occurs within the active time window.

  4. Disconnect Sessions
    When a session’s active period ends, the scheduler gracefully logs it out and closes the TCP connection.

  5. Repeat Continuously
    The scheduler runs continuously, monitoring schedules and adjusting connections automatically as time progresses.

This approach ensures robust, fully automated session lifecycle management aligned with trading calendars.

Programmatic Configuration

Several session schedule implementations are provided to define daily or multi-day trading behavior.

Single-day and Multi-day Schedule

The first two parameters, firstDay and lastDay, define the active trading week.
During these days:

  • If a session’s duration is a single day, it connects at logonTime and disconnects at logoutTime every active day.
  • If a session’s duration spans multiple days, it connects at logonTime on the firstDay and disconnects at logoutTime on the lastDay.

Session sequence numbers are reset at the beginning of each trading week.

File-based Configuration

Schedules and connection parameters can be defined in an XML configuration file and referenced in code.
This approach simplifies deployment and configuration management.

The presets can be loaded using the biz.onixs.cme.ilink3.scheduler.SchedulerSettingsLoader class, allowing both schedules and connection settings to be referenced by string identifiers.

Configuration File Reference

The configuration file uses an XML-based format.
The XML schema can be found here.

Connection Management and Multiple Addresses

By design, a FIX session represents a bilateral connection — a single initiator and a single acceptor.
Therefore, the biz.onixs.cme.ilink3.handler.Session object accepts only one host + port pair.

The scheduler extends this behavior by acting as a connection manager.
It can be configured with a list of addresses (or a single one) as connection parameters.
During connection attempts, the scheduler tries each address in order until a successful connection is established.

You can mimic this behavior manually, but it is strongly recommended to use the built-in scheduler for simplicity and reliability.

Quartz Configuration

The session scheduler uses the Quartz Scheduler library internally.

When started, it loads a default Quartz configuration from the embedded resource:

Error during retrieving content skip as ignoreDownloadError activated.

This configuration is bundled inside the scheduler JAR file.
Custom Quartz configurations can be provided using the biz.onixs.cme.ilink3.scheduler.SessionScheduler.setQuartzConfigFile(String) method.

See the full Quartz configuration reference here.

Samples

See Samples :: Scheduler for examples of usage and configuration.