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 scheduler retry policy configured via setConnectionRetriesNumber(...) and setConnectionRetriesInterval(...).
  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

A biz.onixs.cme.ilink3.handler.Session connects to one endpoint per logon attempt (host + port).

The scheduler acts as a connection manager through

biz.onixs.cme.ilink3.scheduler.SessionConnection.

You can configure one address or an ordered list of addresses. During each scheduler-driven connection cycle, addresses are tried in order until one succeeds.

This keeps endpoint failover and retry logic centralized instead of implementing custom reconnect loops in application code.

CME iLink3 Primary/Backup Notes

For a CME fault-tolerant setup:

The scheduler automates connection timing, but primary/backup role handover and sequence-state alignment remain application responsibilities.

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.