Batch Job Scheduling with JBeret
cfang May 4, 2016 11:47 AMI recently added the following JBeret extension modules to support batch job scheduling:
- jberet-schedule / jberet-schedule-executor
- base module for JBeret scheduling capability
- provides a ScheduledExecutorService-based job scheduler impl
- supports batch job scheduling in Java SE environment, using java.util.concurrent.ScheduledExecutorService
- supports batch job scheduling in Java EE, JBoss EAP & WildFly environment, using Java EE Concurrency Utils and javax.enterprise.concurrent.ManagedScheduledExecutorService
- supports single-action and repeatable job schedules
- jberet-schedule / jberet-schedule-timer
- extends jberet-schedule-executor module with a EJB-Timer-based job scheduler impl
- supports batch job scheduling in Java EE, JBoss EAP & WildFly environment, using EJB TimerService (persistent), or EJB Lite TimerService (non-persistent)
- supports single-action, repeatable, and calendar-based job schedules
- distributable, and supports schedule recovery and server restart
jberet-ui has been updated to include scheduling requirements. More details including screenshots are in JBERET-225 (Add Job Scheduling to jberet-ui), and jberet-ui screenshot images
jberet-rest-api has been updated to include scheduling-related REST API. More details are in JBERET-224 (Add Job Scheduling API to jberet-rest-api)
More impl details can be found in JBERET-222 (Support Batch Job Scheduling)
2 sample webapps were added to demonstrate this new feature:
In addition, jberet-schedule-executor tests shows how to use job scheduling in Java SE environment.
Besides the above 3 built-in types of JobScheduler, one can also implement and specify your own job scheduler.
A comparison of job schedulers based on Java SE ScheduledExecutorService, Java EE Concurreny Utils ManagedScheduledExecutorService, and EJB Timer:
Scheduled Executor Service | Managed Scheduled Executor Service | EJB Timer | |
Suitable for | Java SE | Java EE | Java EE |
Single action schedule | Yes | Yes | Yes |
Repeatable schedule | Yes | Yes | Yes |
Persistent | No | No | Yes |
Calendar-based | No | Yes/No * | Yes |
Distributable | No | No | Yes |
QoS | ? | At most once | At least once |
* ManagedScheduledExecutorService-based scheduler supports calendar-based single-action schedule, but does not support calendar-based repeatable schedule.
We hope this can be useful in your batch application development, and feedback, bug reports and other contributions are always welcome.