Scheduling Reusing a Good Engine Marian Edu medu@ganimede.ro http://www.ganimede.ro
Job Scheduling Batch processing, traditional date and time based execution of background tasks Event-driven process automation, workload is based on the occurrence of external events Service oriented, reusable IT infrastructure service that can play a role in the integration of existing business application
Job Scheduler Computer application for controlling unattended background program execution (batch processing) A service component that is responsible for executing (or notifying) other software components when a pre-determined (scheduled) time arrives
Main Features Interfaces which help to define execution, workflows and/or job dependencies Automatic submission of executions Interfaces to monitor the executions Automatic restart and recovery in event of failures
Options CRON (*NIX) Windows Task Scheduler 4GL 'batch processor' Other?
Quartz... is a richly featured, open source job scheduling library that can be integrated within virtually ANY (Java) application Can be used to create simple or complex schedules for executing tens, hundreds, or even tens-of-thousands of jobs Terracotta Quartz Scheduler (commercial)
Who Use It Jasper Reports, Pentaho, Open Reports Atlassian JIRA, Confluence Sun's OpenESB Liferay Portal
Job Task defined as standard Java component that may execute virtually ANYTHING you may program it to do void execute (JobExecutionContext context) Called by the Scheduler when a Trigger * fires that is associated with the Job * planed execution of a given Job (execution plan, parameters)
Jobs native job (run system command) send email, send message (topic, queue) file system monitor (folder, file) run reports (export, print, send by email) progress runtime (parameters, variables, output) application server call web-service call (WS-Security)
Trigger Planed execution of a given Job Input Job parameters (trigger instance overwrite job's) Priority, misfire instruction, calendar Simple, Interval, Cron
Simple Trigger Start at given time Optionally repeat execution a number of times (can be indefinitely) Optional execution repeat interval
Cron Trigger Execute job at given moments in time Unix 'cron-like' schedule definitions * * * * * * * year day of week (1 7, L, #) month (1-12) day of month (1 31, L, W) hour (0-23) minute (0-59) second (0-59)
Cron Trigger L - last day of month n-th from last day of month (L-3) last weekday of month (7L last Saturday of month) # - n-th week day of month (7#3-3 rd Saturday) W - weekday (Mon-Fri) nearest to day of the month
Job Store Store information about work data : jobs, calendars and execution schedule Tell scheduler what need to be run Manage and control jobs, triggers and calendars Configurable, allows one grouping level Clustering
OpenEdge Integration Job Store: JDBC or Application Server Store work-data in OpenEdge database Java Open Client (proxy-gen, dynamic) Application Server call-back
Application Server Job Store Store Job definition Implementation class Generic/default parameters Store Trigger definition Job Scheduling information Trigger specific parameters Keep Trigger state, record execution
Application Server Job Store acquirenexttriggers isclustered releaseaquiredtrigger triggerfired triggeredjobcomplete
Job Store Configuration org.quartz.jobstore.class org.quartz.jobstore.* (property injection) initialize
Job JobBuilder.newJob() Identity - group & name Instances - class vs. definition (JobDetail) Execute (JobExecutionContext) JobExecutionException re-fire immediately flag
Job Properties / Configuration JobDataMap JobDetail - getjobdatamap() JobExecutionContext - getmergedjobdatamap() Property injection Persist JobData after execution
Job Extra Durable (kept if not scheduled) Request Recovery (start recovery after crash) Disallow Concurrent Execution
Job Schedule - Trigger TriggerBuilder.newTrigger() Identity - group & name For Job With Schedule SimpleScheduleBuilder CronScheduleBuilder
Event Listeners Scheduler Starting / Started Shutting Down / Shutdown On Stand By Error Trigger/Job Scheduled Paused / Resumed Finalized
Event Listeners Email notification Nagios monitoring (www.nagios.org) Message Queue Google Cloud Messaging (Android push)
Put Together Standalone Java Application Server (Tomcat, JBoss, WebSphere, GlassFish) Clustering (Job Store) Open Client + Application Server vs. JDBC
Parlez-vous.Net Quartz.NET is a port of Quartz scheduling library Pure.NET library written in C# Job interface (execute) Job Store (.Net Open Client) Listeners
Try This @ Home Download Java - http://quartz-scheduler.org.net - http://quartznet.sourceforge.net Job Store JDBC/ODBC vs. Open Client Jobs Use existing Extend: Progress Runtime, Application Server Open Client