Programming Guide

Introduction

The Sessions Scheduler service 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. The biz.onixs.cme.ilink3.handler.Session object exposes members for connections basic handling. It also provides users with automatic reconnection facility in case of connection failure. However, there is no way in the session functionality to maintain connections on systematic basis.

To satisfy the needs of real life trading schedules the sessions scheduler component is offered. This service will automatically connect certain sessions to the counterpart at the beginning of the trading day as well as disconnect at the end of a day. It is also possible to keep a FIX session connected for an entire trading week and disconnect it at the end of last trading day.

Main Class

The biz.onixs.cme.ilink3.scheduler.SessionScheduler class is a workhorse of the sessions scheduler component. This class exposes a simple but comprehensive API to handle connections by schedules of any complexity.

Registering a Session

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

Note: If a session is being registered at the time noted by schedule, the the scheduler will connect the session immediately.

Un-registering a Session

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

Note: The un-register method doesn’t disconnect active session from trading system. Therefore, if session was already connected by scheduler, it remains connected after un-registering.

Error Notification

The scheduler accepts the biz.onixs.cme.ilink3.scheduler.ErrorListener event listener to deliver notifications about error in the session management.

Programmatic Configuration

There are different session schedule implementation classes.

Single-day and Multi-day Schedule

The first two parameters (firstDay and lastDay) define activity week. During these days the session will always be connected at logon time and disconnected at logout time if specified session duration equals to a single day. If the session must continue for several days, then the scheduler will connect session at logon time on the day specified by the firstDay parameter and disconnected at logout time on the day specified by lastDay parameter.

The logonTime and logoutTime parameters respectively define time of logon and logout for the session for each activity day if session duration is a single day. If the session must continue for the entire week, then logonTime parameter value specifies the time for logon to be performed on the first day of activity week and logoutTime parameter value defines the time of logout performed on the last day of the activity week.

Finally the scheduler will reset session sequence numbers at the beginning of the each trading week.

File-based Configuration

To simplify development, the session scheduler provides an option to define session schedules and connection settings in the configuration file for later referencing in the source code.

The presets defined in the configuration file can be loaded using biz.onixs.cme.ilink3.scheduler.SchedulerSettingsLoader class. Then both schedules and connection settings can be referenced in the source code using the string identifiers.

Configuration File Reference

The configuration file has XML-based format. The appropriate XML schema is available here.

Samples

Check also Samples :: Scheduler.

Quartz Configuration

Session scheduler uses Quartz Scheduler library internally.

During session scheduler start the quartz is configured using bundled OnixS default quartz configuration file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
org.quartz.scheduler.instanceName: DefaultQuartzScheduler
org.quartz.scheduler.rmi.export: false
org.quartz.scheduler.rmi.proxy: false
org.quartz.scheduler.wrapJobExecutionInUserTransaction: false
  
org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount: 10
org.quartz.threadPool.threadPriority: 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true
  
org.quartz.jobStore.misfireThreshold: 60000
  
org.quartz.jobStore.class: org.quartz.simpl.RAMJobStore
  
org.quartz.scheduler.skipUpdateCheck: true

This configuration file is located inside session scheduler jar.

Custom quartz configuration file can be provided via biz.onixs.cme.ilink3.scheduler.SessionScheduler.setQuartzConfigFile(String) method.

Quartz configuration reference is here.