How to upgrade Session Schedule to Cron-Like format
The article is relevant for clients who are going to upgrade the FIXEdge to version 6.0 and higher.
Overview
Since FIXEdge 6.0 and FIXICC 2.10.1 new functionality of session schedule management has become available. This instruction provides the answers on how to upgrade your current sessions schedule in order to support the cron-like format of the schedule.
Please note, that new Scheduler functionality uses the same notion of schedule properties as old one:
1.How to use cron-like session's schedule functionality with CRON expressions
In order to use the cron-like schedule management functionality follow the steps below:
If you are going to use FIXICC as a tool for cron-like schedule management, you need to specify the following setting in FIXEdge.properties:
FIXICC.Schedules = true
Please use this FIXICC manual for details regarding the schedule management functionality available in FIXICC.
If you are not going to use FIXICC in terms of cron-like schedule management functionality or/and you would like to configure sessions schedule via a configuration file, you may ignore "FIXICC.Schedules" property. Here are the steps which should be performed to configure the schedule via FIXEdge.properties:
First of all, you need to define the Schedule entity in FIXEdge.properties. The common Schedule structure is defined in the following way:
Schedules.<name of schedule>.<section of schedule> = <cron expression>[;<cron expression>....]
Below is the example of how to setup some "default" session's schedule:
Schedules.Schedule1.StartTime = 0 0 8 * * 2-6 Schedules.Schedule1.ConnectTime = 0 0 9 * * 2-6 Schedules.Schedule1.DisconnectTime = 0 0 21 * * 2-6 Schedules.Schedule1.TerminateTime = 0 0 21 * * 6
Then you need to assign the defined schedule to the specific session which should use it:
FixLayer.FixEngine.Session.TestFIXAcceptor.Schedule = Schedule1
Refer to Cron-Like Session Schedule Properties article for details.
If you have old-style schedule properties specified (including DefaultStartTime and DefaultTerminateTime) as well as Cron-Like schedule assigned to the same session, then the Cron-Like schedule will be applied, while all old-style properties will be ignored;
1.1. How to assign one schedule to several sessions
In case you have several sessions that use the same schedule, you may assign one schedule to several sessions.
If we use DefaultSchedule defined above, we can assign it to several sessions (say, TestFIXAcceptor1 and TestFIXAcceptor2) in the following way:
FixLayer.FixEngine.Session.TestFIXAcceptor1.Schedule = Schedule1 FixLayer.FixEngine.Session.TestFIXAcceptor2.Schedule = Schedule1
1.2. How to specify days off and time zone for my schedule
Cron-Like session schedule management functionality provides a possibility to specify Time Zone and Days Off to have a more flexible schedule.
Using these parameters you can get something like the following:
# catholic Christmas: Schedules.Schedule1.DaysOff = * * * 25 12 * # TimeZone: Schedules.Schedule1.TimeZone = EST # Schedule itself: Schedules.Schedule1.StartTime = 0 0 8 * * 2-6 Schedules.Schedule1.ConnectTime = 0 0 9 * * 2-6 Schedules.Schedule1.DisconnectTime = 0 0 21 * * 2-6 Schedules.Schedule1.TerminateTime = 0 0 21 * * 6
2. How to use assign CRON expression to my current session's schedule
CRON expressions can be also assigned to your current sessions schedules defined in Old-Style Session Schedule Properties:
# weekly from Monday to Friday from 08:00 to 18:00 FixLayer.FixEngine.Session.TestFIXAcceptor1.ConnectTime = 0 0 08 * * 2-6 FixLayer.FixEngine.Session.TestFIXAcceptor1.DisconnectTime = 0 0 18 * * 2-6 FixLayer.FixEngine.Session.TestFIXAcceptor1.TerminateTime = 0 0 18 * * 6 # weekly from Monday to Friday from 08:00 to 21:00 FixLayer.FixEngine.Session.TestFIXAcceptor2.ConnectTime = 0 0 8 * * 2-6 FixLayer.FixEngine.Session.TestFIXAcceptor2.DisconnectTime = 0 0 21 * * 2-6 FixLayer.FixEngine.Session.TestFIXAcceptor2.TerminateTime = 0 0 21 * * 6
The same logic is applicable to DefaultStartTime and DefaultTerminateTime properties.
If you are going to use FIXICC as a tool for Cron-Like schedule management, you need to specify the following setting in FIXEdge.properties:
FIXICC.Schedules = true
CRON has the following syntax:
┌──────────── second (0 - 59)
│ ┌───────────── minute (0 - 59)
| │ ┌───────────── hour (0 - 23) | │ │ ┌───────────── day of month (1 - 31) | │ │ │ ┌───────────── month (1 - 12) | │ │ │ │ ┌───────────── day of week (1 - 7: Sunday to Saturday) | │ │ │ │ │
│ │ │ │ │ │
│ │ │ │ │ │
* * * * * *
Support of the CRON expressions is limited by quartz. In particular, specifying both a day-of-week and day-of-month values is prohibited (you'll need to use the '*' character in one of these fields).
The only note here is that '*' character is used instead of '?' character in comparison with quartz.
Several CRON expressions can be assigned for each property, they should be delimited by a semicolon:
# day session is from 8am to 2pm, evening session is from 4pm to 4am next day FixLayer.FixEngine.Session.TestFIXAcceptor.ConnectTime = 0 0 8 * * *; 0 0 16 * * * FixLayer.FixEngine.Session.TestFIXAcceptor.DisconnectTime = 0 0 14 * * *; 0 0 4 * * * FixLayer.FixEngine.Session.TestFIXAcceptor.TerminateTime = 0 0 14 * * *; 0 0 4 * * *
Both formats - CRON expression and HH:MM - can be supported by FIXEdge simultaneously in one schedule. In other words, user's session's schedule can be setup in the following way:
FixLayer.FixEngine.Session.TestFIXAcceptor.StartTime = 0 0 8 * * * FixLayer.FixEngine.Session.TestFIXAcceptor.ConnectTime = 09:00 FixLayer.FixEngine.Session.TestFIXAcceptor.DisconnectTime = 0 58 23 * * * FixLayer.FixEngine.Session.TestFIXAcceptor.TerminateTime = 23:59
The thing is that HH:MM is just converted to the CRON expression like 0 MM HH * * *.
3. How to keep using my current session's schedule
In order to keep using your current session's schedule, no additional actions are required.
In other words, you may safely use your current configuration if your session's schedule is configured in the following way:
FixLayer.FixEngine.Session.TestFIXAcceptor.StartTime = 08:00 FixLayer.FixEngine.Session.TestFIXAcceptor.ConnectTime = 09:00 FixLayer.FixEngine.Session.TestFIXAcceptor.DisconnectTime = 23:58 FixLayer.FixEngine.Session.TestFIXAcceptor.TerminateTime = 23:59
Please see Old-Style Session Schedule Properties for reference.
Also, you may continue using properties DefaultStartTime and DefaultTerminateTime.